const root = nodeOps.createElement('div')
const children = ref([h('div', 'teleported')])
- render(h(Teleport, { to: target }, children.value), root)
+ render(h(() => h(Teleport, { to: target }, children.value)), root)
expect(serializeInner(target)).toMatchInlineSnapshot(
`"<div>teleported</div>"`
)
children.value = []
await nextTick()
- expect(serializeInner(target)).toMatchInlineSnapshot(
- `"<div>teleported</div>"`
- )
+ expect(serializeInner(target)).toMatchInlineSnapshot(`""`)
children.value = [createVNode(Text, null, 'teleported')]
await nextTick()
- expect(serializeInner(target)).toMatchInlineSnapshot(
- `"<div>teleported</div>"`
- )
+ expect(serializeInner(target)).toMatchInlineSnapshot(`"teleported"`)
})
test('should remove children when unmounted', () => {