Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/shared/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ export function isFalse (v: any): boolean %checks {
* Check if value is primitive
*/
export function isPrimitive (value: any): boolean %checks {
return typeof value === 'string' || typeof value === 'number'
return (
typeof value === 'string' ||
typeof value === 'number' ||
typeof value === 'boolean'
)
}

/**
Expand Down
9 changes: 9 additions & 0 deletions test/unit/modules/vdom/create-element.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ describe('create-element', () => {
expect('Avoid using non-primitive value as key').toHaveBeenWarned()
})

it('doesn\'t warn boolean key', () => {
new Vue({
render (h) {
return h('div', { key: true })
}
}).$mount()
expect('Avoid using non-primitive value as key').not.toHaveBeenWarned()
})

it('nested child elements should be updated correctly', done => {
const vm = new Vue({
data: { n: 1 },
Expand Down