File tree 1 file changed +18
-18
lines changed
test/unit/features/global-api
1 file changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,24 @@ describe('Global API: set/delete', () => {
52
52
expect ( vm . $el . innerHTML ) . toBe ( '' )
53
53
} ) . then ( done )
54
54
} )
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
+ } )
55
73
} )
56
74
57
75
describe ( 'Vue.delete' , ( ) => {
@@ -96,23 +114,5 @@ describe('Global API: set/delete', () => {
96
114
expect ( vm . $el . innerHTML ) . toBe ( '' )
97
115
} ) . then ( done )
98
116
} )
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
- } )
117
117
} )
118
118
} )
You can’t perform that action at this time.
0 commit comments