Skip to content

Commit 8f6c1e0

Browse files
committed
test: add test
1 parent 76e719b commit 8f6c1e0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

packages/runtime-dom/__tests__/helpers/useCssVars.spec.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
nextTick,
99
ComponentOptions,
1010
Suspense,
11+
Teleport,
1112
FunctionalComponent
1213
} from '@vue/runtime-dom'
1314

@@ -196,4 +197,23 @@ describe('useCssVars', () => {
196197
expect((c as HTMLElement).style.getPropertyValue(`--color`)).toBe('red')
197198
}
198199
})
200+
201+
test('with teleport', async () => {
202+
const state = reactive({ color: 'red' })
203+
const root = document.createElement('div')
204+
const target = document.createElement('div')
205+
206+
const App = {
207+
setup() {
208+
useCssVars(() => state)
209+
return () => [h(Teleport, { to: target }, [h('div')])]
210+
}
211+
}
212+
213+
render(h(App), root)
214+
await nextTick()
215+
for (const c of [].slice.call(target.children as any)) {
216+
expect((c as HTMLElement).style.getPropertyValue(`--color`)).toBe('red')
217+
}
218+
})
199219
})

0 commit comments

Comments
 (0)