test(teleport): fix meaningless test case (#2872)

This commit is contained in:
2021-07-16 04:36:36 +08:00 committed by GitHub
parent 3756270272
commit b31712ecc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -106,7 +106,7 @@ describe('renderer: teleport', () => {
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>"`
)
@ -114,16 +114,12 @@ describe('renderer: teleport', () => {
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', () => {