File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
test/unit/specs/directives Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ module.exports = {
43
43
} ,
44
44
45
45
insert : function ( ) {
46
+ // avoid duplicate inserts, since update() can be
47
+ // called with different truthy values
48
+ if ( this . decompile ) {
49
+ return
50
+ }
46
51
var vm = this . vm
47
52
var frag = templateParser . clone ( this . template )
48
53
var decompile = this . linker ( vm , frag )
Original file line number Diff line number Diff line change @@ -145,6 +145,22 @@ if (_.inBrowser) {
145
145
} )
146
146
} )
147
147
148
+ it ( 'v-if with different truthy values' , function ( done ) {
149
+ var vm = new Vue ( {
150
+ el : el ,
151
+ data : {
152
+ a : 1
153
+ } ,
154
+ template : '<div v-if="a">{{a}}</div>'
155
+ } )
156
+ expect ( el . innerHTML ) . toBe ( wrap ( '<div>1</div>' ) )
157
+ vm . a = 2
158
+ _ . nextTick ( function ( ) {
159
+ expect ( el . innerHTML ) . toBe ( wrap ( '<div>2</div>' ) )
160
+ done ( )
161
+ } )
162
+ } )
163
+
148
164
it ( 'invalid warn' , function ( ) {
149
165
el . setAttribute ( 'v-if' , 'test' )
150
166
var vm = new Vue ( {
You can’t perform that action at this time.
0 commit comments