]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test(teleport): fix meaningless test case (#2872)
author <31395977+leaon4@users.noreply.github.com>
Thu, 15 Jul 2021 20:36:36 +0000 (04:36 +0800)
committerGitHub <noreply@github.com>
Thu, 15 Jul 2021 20:36:36 +0000 (16:36 -0400)
packages/runtime-core/__tests__/components/Teleport.spec.ts

index 8b234e2b1e6133d346aa5c0800c8b009eaeb5bf1..e0a50b140c98aeca7a7a732d1790a3475763e968 100644 (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', () => {