Skip to content

Commit

Permalink
test: assert vnode invalid key warning for NaN
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jul 8, 2020
1 parent 4b5ce8b commit 00f6031
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/runtime-core/__tests__/vnode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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', () => {
Expand Down

0 comments on commit 00f6031

Please sign in to comment.