@@ -392,87 +392,149 @@ describe('mounting options: stubs', () => {
392
392
)
393
393
} )
394
394
395
- it ( 'stubs transition by default' , ( ) => {
396
- const Comp = {
397
- template : `<transition><div id="content" /></transition>`
398
- }
399
- const wrapper = mount ( Comp )
395
+ describe ( 'transition' , ( ) => {
396
+ it ( 'stubs transition by default' , ( ) => {
397
+ const Comp = {
398
+ template : `<transition><div id="content" /></transition>`
399
+ }
400
+ const wrapper = mount ( Comp )
400
401
401
- expect ( wrapper . html ( ) ) . toBe (
402
- '<transition-stub>\n' +
403
- ' <div id="content"></div>\n' +
404
- '</transition-stub>'
405
- )
406
- } )
402
+ expect ( wrapper . html ( ) ) . toBe (
403
+ '<transition-stub>\n' +
404
+ ' <div id="content"></div>\n' +
405
+ '</transition-stub>'
406
+ )
407
+ } )
407
408
408
- it ( 'opts out of stubbing transition by default' , ( ) => {
409
- const Comp = {
410
- template : `<transition><div id="content" /></transition>`
411
- }
412
- const wrapper = mount ( Comp , {
413
- global : {
414
- stubs : {
415
- transition : false
416
- }
409
+ it ( 'opts out of stubbing transition by default' , ( ) => {
410
+ const Comp = {
411
+ template : `<transition><div id="content" /></transition>`
417
412
}
413
+ const wrapper = mount ( Comp , {
414
+ global : {
415
+ stubs : {
416
+ transition : false
417
+ }
418
+ }
419
+ } )
420
+
421
+ // Vue removes <transition> at run-time and does it's magic, so <transition> should not
422
+ // appear in the html when it isn't stubbed.
423
+ expect ( wrapper . html ( ) ) . toBe ( '<div id="content"></div>' )
418
424
} )
419
425
420
- // Vue removes <transition> at run-time and does it's magic, so <transition> should not
421
- // appear in the html when it isn't stubbed.
422
- expect ( wrapper . html ( ) ) . toBe ( '<div id="content"></div>' )
426
+ it ( 'does not stub transition on shallow with false' , ( ) => {
427
+ const Comp = {
428
+ template : `<transition><div id="content" /></transition>`
429
+ }
430
+ const wrapper = mount ( Comp , {
431
+ shallow : true ,
432
+ global : {
433
+ stubs : {
434
+ transition : false
435
+ }
436
+ }
437
+ } )
438
+
439
+ // Vue removes <transition> at run-time and does it's magic, so <transition> should not
440
+ // appear in the html when it isn't stubbed.
441
+ expect ( wrapper . html ( ) ) . toBe ( '<div id="content"></div>' )
442
+ } )
423
443
} )
424
444
425
- it ( 'opts out of stubbing transition-group by default' , ( ) => {
426
- const Comp = {
427
- template : `<transition-group><div key="content" id="content" /></transition-group>`
428
- }
429
- const wrapper = mount ( Comp , {
430
- global : {
431
- stubs : {
432
- 'transition-group' : false
433
- }
445
+ describe ( 'transition-group' , ( ) => {
446
+ it ( 'stubs transition-group by default' , ( ) => {
447
+ const Comp = {
448
+ template : `<transition-group><div key="a" id="content" /></transition-group>`
434
449
}
450
+ const wrapper = mount ( Comp )
451
+ expect ( wrapper . find ( '#content' ) . exists ( ) ) . toBe ( true )
435
452
} )
436
453
437
- // Vue removes <transition-group> at run-time and does it's magic, so <transition-group> should not
438
- // appear in the html when it isn't stubbed.
439
- expect ( wrapper . html ( ) ) . toBe ( '<div id="content"></div>' )
440
- } )
454
+ it ( 'opts out of stubbing transition-group by default' , ( ) => {
455
+ const Comp = {
456
+ template : `<transition-group><div key="content" id="content" /></transition-group>`
457
+ }
458
+ const wrapper = mount ( Comp , {
459
+ global : {
460
+ stubs : {
461
+ 'transition-group' : false
462
+ }
463
+ }
464
+ } )
441
465
442
- it ( 'stubs transition-group by default' , ( ) => {
443
- const Comp = {
444
- template : `<transition-group><div key="a" id="content" /></transition-group>`
445
- }
446
- const wrapper = mount ( Comp )
447
- expect ( wrapper . find ( '#content' ) . exists ( ) ) . toBe ( true )
448
- } )
466
+ // Vue removes <transition-group> at run-time and does it's magic, so <transition-group> should not
467
+ // appear in the html when it isn't stubbed.
468
+ expect ( wrapper . html ( ) ) . toBe ( '<div id="content"></div>' )
469
+ } )
449
470
450
- it ( 'does not stub teleport by default' , ( ) => {
451
- const Comp = {
452
- template : `<teleport to="body"><div id="content" /></teleport>`
453
- }
454
- const wrapper = mount ( Comp )
471
+ it ( 'does not stub transition-group on shallow with false' , ( ) => {
472
+ const Comp = {
473
+ template : `<transition-group><div key="content" id="content" /></transition-group>`
474
+ }
475
+ const wrapper = mount ( Comp , {
476
+ shallow : true ,
477
+ global : {
478
+ stubs : {
479
+ 'transition-group' : false
480
+ }
481
+ }
482
+ } )
455
483
456
- expect ( wrapper . html ( ) ) . toBe (
457
- '<!--teleport start-->\n' + '<!--teleport end-->'
458
- )
484
+ // Vue removes <transition-group> at run-time and does it's magic, so <transition-group> should not
485
+ // appear in the html when it isn't stubbed.
486
+ expect ( wrapper . html ( ) ) . toBe ( '<div id="content"></div>' )
487
+ } )
459
488
} )
460
489
461
- it ( 'opts in to stubbing teleport ' , ( ) => {
462
- const Comp = {
463
- template : `<teleport to="body"><div id="content" /></teleport>`
464
- }
465
- const wrapper = mount ( Comp , {
466
- global : {
467
- stubs : {
468
- teleport : true
469
- }
490
+ describe ( 'teleport' , ( ) => {
491
+ it ( 'does not stub teleport by default' , ( ) => {
492
+ const Comp = {
493
+ template : `<teleport to="body"><div id="content" /></teleport>`
470
494
}
495
+ const wrapper = mount ( Comp )
496
+
497
+ expect ( wrapper . html ( ) ) . toBe (
498
+ '<!--teleport start-->\n' + '<!--teleport end-->'
499
+ )
471
500
} )
472
501
473
- expect ( wrapper . html ( ) ) . toBe (
474
- '<teleport-stub>\n' + ' <div id="content"></div>\n' + '</teleport-stub>'
475
- )
502
+ it ( 'opts in to stubbing teleport ' , ( ) => {
503
+ const Comp = {
504
+ template : `<teleport to="body"><div id="content" /></teleport>`
505
+ }
506
+ const wrapper = mount ( Comp , {
507
+ global : {
508
+ stubs : {
509
+ teleport : true
510
+ }
511
+ }
512
+ } )
513
+
514
+ expect ( wrapper . html ( ) ) . toBe (
515
+ '<teleport-stub>\n' +
516
+ ' <div id="content"></div>\n' +
517
+ '</teleport-stub>'
518
+ )
519
+ } )
520
+
521
+ it ( 'does not stub teleport with shallow' , ( ) => {
522
+ const Comp = {
523
+ template : `<teleport to="body"><div id="content" /></teleport>`
524
+ }
525
+ const wrapper = mount ( Comp , {
526
+ shallow : true ,
527
+ global : {
528
+ stubs : {
529
+ teleport : false
530
+ }
531
+ }
532
+ } )
533
+
534
+ expect ( wrapper . html ( ) ) . toBe (
535
+ '<!--teleport start-->\n' + '<!--teleport end-->'
536
+ )
537
+ } )
476
538
} )
477
539
478
540
it ( 'stubs component by key prior before name' , ( ) => {
0 commit comments