test: assert vnode invalid key warning for NaN
This commit is contained in:
parent
4b5ce8b456
commit
00f6031fbf
@ -11,12 +11,14 @@ import {
|
||||
transformVNodeArgs
|
||||
} from '../src/vnode'
|
||||
import { Data } from '../src/component'
|
||||
import { ShapeFlags, PatchFlags } from '@vue/shared'
|
||||
import { ShapeFlags, PatchFlags, mockWarn } from '@vue/shared'
|
||||
import { h, reactive, isReactive } from '../src'
|
||||
import { createApp, nodeOps, serializeInner } from '@vue/runtime-test'
|
||||
import { setCurrentRenderingInstance } from '../src/componentRenderUtils'
|
||||
|
||||
describe('vnode', () => {
|
||||
mockWarn()
|
||||
|
||||
test('create with just tag', () => {
|
||||
const vnode = createVNode('p')
|
||||
expect(vnode.type).toBe('p')
|
||||
@ -62,6 +64,7 @@ describe('vnode', () => {
|
||||
}
|
||||
expect(createVNode('div').key).toBe(null)
|
||||
expect(createVNode('div', { key: undefined }).key).toBe(null)
|
||||
expect(`VNode created with invalid key (NaN)`).toHaveBeenWarned()
|
||||
})
|
||||
|
||||
test('create with class component', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user