test(runtime-core): fix test for vnode key (#846)

This commit is contained in:
djy0 2020-03-17 01:06:03 +08:00 committed by GitHub
parent d9dd1d8a0a
commit bcb750bb3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,12 +38,12 @@ describe('vnode', () => {
expect(vnode.props).toBe(null) expect(vnode.props).toBe(null)
}) })
test('valid vnode keys', () => { test('vnode keys', () => {
let vnode for (const key of ['', 'a', 0, 1, NaN]) {
for (const key in ['', '1', -1, 0, 1, null]) { expect(createVNode('div', { key }).key).toBe(key)
vnode = createVNode('div', { key })
expect(vnode.key).toBe(key)
} }
expect(createVNode('div').key).toBe(null)
expect(createVNode('div', { key: undefined }).key).toBe(null)
}) })
test('create with class component', () => { test('create with class component', () => {