]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test(runtime-core): show warn when create with invalid type (#2128)
authoredison <daiwei521@126.com>
Tue, 13 Oct 2020 19:27:21 +0000 (03:27 +0800)
committerGitHub <noreply@github.com>
Tue, 13 Oct 2020 19:27:21 +0000 (15:27 -0400)
packages/runtime-core/__tests__/vnode.spec.ts

index 09d7f54ceaef42286f85ce2941c378ed87d5837a..5bfde8e59762efcec214fa48cb4f8ac4f77ee58e 100644 (file)
@@ -42,6 +42,12 @@ describe('vnode', () => {
     expect(vnode.props).toBe(null)
   })
 
+  test('show warn when create with invalid type', () => {
+    const vnode = createVNode('')
+    expect('Invalid vnode type when creating vnode').toHaveBeenWarned()
+    expect(vnode.type).toBe(Comment)
+  })
+
   test('create from an existing vnode', () => {
     const vnode1 = createVNode('p', { id: 'foo' })
     const vnode2 = createVNode(vnode1, { class: 'bar' }, 'baz')