@@ -452,6 +452,36 @@ describe('mounting options: stubs', () => {
452452 // appear in the html when it isn't stubbed.
453453 expect ( wrapper . html ( ) ) . toBe ( '<div id="content"></div>' )
454454 } )
455+
456+ it ( 'does not stub transition after overriding config.global.stubs' , ( ) => {
457+ const Comp = {
458+ template : `<transition><div id="content-global-stubs-no-transition" /></transition>`
459+ }
460+ config . global . stubs = { }
461+ const wrapper = mount ( Comp )
462+
463+ // Vue removes <transition> at run-time and does it's magic, so <transition> should not
464+ // appear in the html when it isn't stubbed.
465+ expect ( wrapper . html ( ) ) . toBe (
466+ '<div id="content-global-stubs-no-transition"></div>'
467+ )
468+ } )
469+
470+ it ( 'stub transition after overriding config.global.stubs with Transition: true PascalCase' , ( ) => {
471+ const Comp = {
472+ template : `<transition><div id="content-global-stubs-transition" /></transition>`
473+ }
474+ config . global . stubs = {
475+ Transition : true
476+ }
477+ const wrapper = mount ( Comp )
478+
479+ expect ( wrapper . html ( ) ) . toBe (
480+ '<transition-stub appear="false" persisted="false" css="true">\n' +
481+ ' <div id="content-global-stubs-transition"></div>\n' +
482+ '</transition-stub>'
483+ )
484+ } )
455485 } )
456486
457487 describe ( 'transition-group' , ( ) => {
@@ -497,6 +527,36 @@ describe('mounting options: stubs', () => {
497527 // appear in the html when it isn't stubbed.
498528 expect ( wrapper . html ( ) ) . toBe ( '<div id="content"></div>' )
499529 } )
530+
531+ it ( 'does not stub transition-group after overriding config.global.stubs' , ( ) => {
532+ const Comp = {
533+ template : `<transition-group><div key="content" id="content-global-stubs-no-transition-group" /></transition-group>`
534+ }
535+ config . global . stubs = { }
536+ const wrapper = mount ( Comp )
537+
538+ // Vue removes <transition-group> at run-time and does it's magic, so <transition-group> should not
539+ // appear in the html when it isn't stubbed.
540+ expect ( wrapper . html ( ) ) . toBe (
541+ '<div id="content-global-stubs-no-transition-group"></div>'
542+ )
543+ } )
544+
545+ it ( 'stub transition-group after overriding config.global.stubs with TransitionGroup: true in PascalCase' , ( ) => {
546+ const Comp = {
547+ template : `<transition-group><div key="content" id="content-global-stubs-transition-group" /></transition-group>`
548+ }
549+ config . global . stubs = {
550+ TransitionGroup : true
551+ }
552+ const wrapper = mount ( Comp )
553+
554+ expect ( wrapper . html ( ) ) . toBe (
555+ '<transition-group-stub appear="false" persisted="false" css="true">\n' +
556+ ' <div id="content-global-stubs-transition-group"></div>\n' +
557+ '</transition-group-stub>'
558+ )
559+ } )
500560 } )
501561
502562 describe ( 'teleport' , ( ) => {
@@ -551,6 +611,25 @@ describe('mounting options: stubs', () => {
551611 '<!--teleport start-->\n' + '<!--teleport end-->'
552612 )
553613 } )
614+
615+ it ( 'opts in to stubbing teleport with Teleport: true' , ( ) => {
616+ const Comp = {
617+ template : `<teleport to="body"><div id="content-global-stubs-teleport" /></teleport>`
618+ }
619+ const wrapper = mount ( Comp , {
620+ global : {
621+ stubs : {
622+ Teleport : true
623+ }
624+ }
625+ } )
626+
627+ expect ( wrapper . html ( ) ) . toBe (
628+ '<teleport-stub to="body">\n' +
629+ ' <div id="content-global-stubs-teleport"></div>\n' +
630+ '</teleport-stub>'
631+ )
632+ } )
554633 } )
555634
556635 describe ( 'keep-alive' , ( ) => {
0 commit comments