Skip to content

Commit 00a3085

Browse files
lyhperyyx990803
authored andcommitted
test: correcting existing test case (#5909)
Fix the location of the test case
1 parent f6cd44c commit 00a3085

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

Diff for: test/unit/features/global-api/set-delete.spec.js

+18-18
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,24 @@ describe('Global API: set/delete', () => {
5252
expect(vm.$el.innerHTML).toBe('')
5353
}).then(done)
5454
})
55+
56+
it('be able to use string type index in array', done => {
57+
const vm = new Vue({
58+
template: '<div><p v-for="obj in lists">{{obj.name}}</p></div>',
59+
data: {
60+
lists: [
61+
{ name: 'A' },
62+
{ name: 'B' },
63+
{ name: 'C' }
64+
]
65+
}
66+
}).$mount()
67+
expect(vm.$el.innerHTML).toBe('<p>A</p><p>B</p><p>C</p>')
68+
Vue.set(vm.lists, '0', { name: 'D' })
69+
waitForUpdate(() => {
70+
expect(vm.$el.innerHTML).toBe('<p>D</p><p>B</p><p>C</p>')
71+
}).then(done)
72+
})
5573
})
5674

5775
describe('Vue.delete', () => {
@@ -96,23 +114,5 @@ describe('Global API: set/delete', () => {
96114
expect(vm.$el.innerHTML).toBe('')
97115
}).then(done)
98116
})
99-
100-
it('be able to use string type index in array', done => {
101-
const vm = new Vue({
102-
template: '<div><p v-for="obj in lists">{{obj.name}}</p></div>',
103-
data: {
104-
lists: [
105-
{ name: 'A' },
106-
{ name: 'B' },
107-
{ name: 'C' }
108-
]
109-
}
110-
}).$mount()
111-
expect(vm.$el.innerHTML).toBe('<p>A</p><p>B</p><p>C</p>')
112-
Vue.set(vm.lists, '0', { name: 'D' })
113-
waitForUpdate(() => {
114-
expect(vm.$el.innerHTML).toBe('<p>D</p><p>B</p><p>C</p>')
115-
}).then(done)
116-
})
117117
})
118118
})

0 commit comments

Comments
 (0)