|
|
@@ -348,7 +348,7 @@ describe('Directive v-for', () => {
|
|
|
},
|
|
|
template:
|
|
|
'<div>' +
|
|
|
- '<test v-for="item in list" :msg="item.a">' +
|
|
|
+ '<test v-for="item in list" :msg="item.a" :key="item.a">' +
|
|
|
'<span>{{item.a}}</span>' +
|
|
|
'</test>' +
|
|
|
'</div>',
|
|
|
@@ -387,7 +387,7 @@ describe('Directive v-for', () => {
|
|
|
},
|
|
|
template:
|
|
|
'<div>' +
|
|
|
- '<component v-for="item in list" :is="item.type"></component>' +
|
|
|
+ '<component v-for="item in list" :key="item.type" :is="item.type"></component>' +
|
|
|
'</div>',
|
|
|
components: {
|
|
|
one: {
|
|
|
@@ -405,6 +405,19 @@ describe('Directive v-for', () => {
|
|
|
}).then(done)
|
|
|
})
|
|
|
|
|
|
+ it('should warn component v-for without keys', () => {
|
|
|
+ new Vue({
|
|
|
+ template: `<div><test v-for="i in 3"></test></div>`,
|
|
|
+ components: {
|
|
|
+ test: {
|
|
|
+ render () {}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).$mount()
|
|
|
+ expect('<test v-for="i in 3">: component lists rendered with v-for should have explicit keys')
|
|
|
+ .toHaveBeenWarned()
|
|
|
+ })
|
|
|
+
|
|
|
it('multi nested array reactivity', done => {
|
|
|
const vm = new Vue({
|
|
|
data: {
|