File tree Expand file tree Collapse file tree 1 file changed +18
-18
lines changed
test/unit/features/global-api Expand file tree Collapse file tree 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', () => {
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} )
You can’t perform that action at this time.
0 commit comments