diff --git a/packages/runtime-dom/__tests__/helpers/useCssVars.spec.ts b/packages/runtime-dom/__tests__/helpers/useCssVars.spec.ts index fb22529f42d..93f972e99cb 100644 --- a/packages/runtime-dom/__tests__/helpers/useCssVars.spec.ts +++ b/packages/runtime-dom/__tests__/helpers/useCssVars.spec.ts @@ -8,6 +8,7 @@ import { nextTick, ComponentOptions, Suspense, + Teleport, FunctionalComponent } from '@vue/runtime-dom' @@ -196,4 +197,23 @@ describe('useCssVars', () => { expect((c as HTMLElement).style.getPropertyValue(`--color`)).toBe('red') } }) + + test('with teleport', async () => { + const state = reactive({ color: 'red' }) + const root = document.createElement('div') + const target = document.createElement('div') + + const App = { + setup() { + useCssVars(() => state) + return () => [h(Teleport, { to: target }, [h('div')])] + } + } + + render(h(App), root) + await nextTick() + for (const c of [].slice.call(target.children as any)) { + expect((c as HTMLElement).style.getPropertyValue(`--color`)).toBe('red') + } + }) })