File tree 1 file changed +25
-1
lines changed
1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -270,7 +270,29 @@ if (_.inBrowser) {
270
270
expect ( childSpy ) . toHaveBeenCalledWith ( 2 )
271
271
} )
272
272
273
- it ( 'should remove transcluded directives from parent when unlinking' , function ( done ) {
273
+ it ( 'should remove transcluded directives from parent when unlinking (v-component)' , function ( ) {
274
+ var vm = new Vue ( {
275
+ el : el ,
276
+ template :
277
+ '<div v-component="test">{{test}}</div>' ,
278
+ data : {
279
+ test : 'parent'
280
+ } ,
281
+ components : {
282
+ test : {
283
+ template : '<content></content>'
284
+ }
285
+ }
286
+ } )
287
+ expect ( vm . $el . textContent ) . toBe ( 'parent' )
288
+ expect ( vm . _directives . length ) . toBe ( 2 )
289
+ expect ( vm . _children . length ) . toBe ( 1 )
290
+ vm . _children [ 0 ] . $destroy ( )
291
+ expect ( vm . _directives . length ) . toBe ( 1 )
292
+ expect ( vm . _children . length ) . toBe ( 0 )
293
+ } )
294
+
295
+ it ( 'should remove transcluded directives from parent when unlinking (v-if + v-component)' , function ( done ) {
274
296
var vm = new Vue ( {
275
297
el : el ,
276
298
template :
@@ -289,10 +311,12 @@ if (_.inBrowser) {
289
311
} )
290
312
expect ( vm . $el . textContent ) . toBe ( 'parent' )
291
313
expect ( vm . _directives . length ) . toBe ( 3 )
314
+ expect ( vm . _children . length ) . toBe ( 1 )
292
315
vm . ok = false
293
316
_ . nextTick ( function ( ) {
294
317
expect ( vm . $el . textContent ) . toBe ( '' )
295
318
expect ( vm . _directives . length ) . toBe ( 1 )
319
+ expect ( vm . _children . length ) . toBe ( 0 )
296
320
done ( )
297
321
} )
298
322
} )
You can’t perform that action at this time.
0 commit comments