File tree 1 file changed +20
-0
lines changed
test/unit/features/directives
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,26 @@ describe('Directive v-once', () => {
13
13
} ) . then ( done )
14
14
} )
15
15
16
+ it ( 'should correctly render list items' , done => {
17
+ const list = [ 'foo' , 'bar' ]
18
+ const MyComponent = Vue . extend ( {
19
+ props : [ 'item' ] ,
20
+ template : '<div v-once>{{ item }}</div>' ,
21
+ } )
22
+ const vm = new Vue ( {
23
+ components : {
24
+ MyComponent
25
+ } ,
26
+ template : '<ul><my-component v-for="item, index in list" :key="index" :item="item"></my-component></ul>' ,
27
+ data : { list }
28
+ } ) . $mount ( )
29
+ list . forEach ( ( item , index ) => expect ( vm . $el . children [ index ] . innerHTML ) . toBe ( item ) )
30
+ vm . list = [ 'quz' , 'qux' ]
31
+ waitForUpdate ( ( ) => {
32
+ list . forEach ( ( item , index ) => expect ( vm . $el . children [ index ] . innerHTML ) . toBe ( item ) )
33
+ } ) . then ( done )
34
+ } )
35
+
16
36
it ( 'should not rerender self and child component' , done => {
17
37
const vm = new Vue ( {
18
38
template : `
You can’t perform that action at this time.
0 commit comments