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

This commit is contained in:
edison 2020-10-14 03:27:21 +08:00 committed by GitHub
parent 692197be33
commit 1cc8cd60a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,6 +42,12 @@ describe('vnode', () => {
expect(vnode.props).toBe(null) 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', () => { test('create from an existing vnode', () => {
const vnode1 = createVNode('p', { id: 'foo' }) const vnode1 = createVNode('p', { id: 'foo' })
const vnode2 = createVNode(vnode1, { class: 'bar' }, 'baz') const vnode2 = createVNode(vnode1, { class: 'bar' }, 'baz')