Procházet zdrojové kódy

test(runtime-core): show warn when create with invalid type (#2128)

edison před 5 roky
rodič
revize
1cc8cd60a1
1 změnil soubory, kde provedl 6 přidání a 0 odebrání
  1. 6 0
      packages/runtime-core/__tests__/vnode.spec.ts

+ 6 - 0
packages/runtime-core/__tests__/vnode.spec.ts

@@ -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')