File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
test/unit/specs/directives Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,8 @@ module.exports = {
2727 this . linker = compiler . compile (
2828 this . template ,
2929 this . vm . $options ,
30- true
30+ true , // partial
31+ this . _host // important
3132 )
3233 cache . put ( cacheId , this . linker )
3334 }
Original file line number Diff line number Diff line change @@ -327,5 +327,33 @@ if (_.inBrowser) {
327327 }
328328 } )
329329
330+ // #1097 v-if components not having correct parent
331+ it ( 'compile with correct transclusion host' , function ( ) {
332+ var parentA
333+ var parentB
334+ new Vue ( {
335+ el : el ,
336+ data : {
337+ show : true
338+ } ,
339+ template : '<parent><child v-if="show"></child></parent>' ,
340+ components : {
341+ parent : {
342+ template : '<content></content>' ,
343+ created : function ( ) {
344+ parentA = this
345+ }
346+ } ,
347+ child : {
348+ created : function ( ) {
349+ parentB = this . $parent
350+ }
351+ }
352+ }
353+ } )
354+ expect ( parentA ) . toBeTruthy ( )
355+ expect ( parentA ) . toBe ( parentB )
356+ } )
357+
330358 } )
331359}
You can’t perform that action at this time.
0 commit comments