|
|
@@ -489,7 +489,7 @@ describe('Directive v-for', () => {
|
|
|
const vm = new Vue({
|
|
|
template:
|
|
|
'<div attr>' +
|
|
|
- '<foo v-for="item in list">{{ item }}</foo>' +
|
|
|
+ '<foo v-for="item in list" :key="item">{{ item }}</foo>' +
|
|
|
'</div>',
|
|
|
data: {
|
|
|
list: undefined
|
|
|
@@ -507,6 +507,23 @@ describe('Directive v-for', () => {
|
|
|
}).then(done)
|
|
|
})
|
|
|
|
|
|
+ it('elements with v-for and empty list', done => {
|
|
|
+ const vm = new Vue({
|
|
|
+ template:
|
|
|
+ '<div attr>' +
|
|
|
+ '<div v-for="item in list">{{ item }}</div>' +
|
|
|
+ '</div>',
|
|
|
+ data: {
|
|
|
+ list: undefined
|
|
|
+ }
|
|
|
+ }).$mount()
|
|
|
+ expect(vm.$el.innerHTML).toBe('')
|
|
|
+ vm.list = [1, 2, 3]
|
|
|
+ waitForUpdate(() => {
|
|
|
+ expect(vm.$el.innerHTML).toBe('<div>1</div><div>2</div><div>3</div>')
|
|
|
+ }).then(done)
|
|
|
+ })
|
|
|
+
|
|
|
const supportsDestructuring = (() => {
|
|
|
try {
|
|
|
new Function('var { foo } = bar')
|