test(runtime-core): fix test for vnode key (#846)
This commit is contained in:
parent
d9dd1d8a0a
commit
bcb750bb3a
@ -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', () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user