@@ -563,7 +563,7 @@ describe('mounting options: stubs', () => {
563
563
expect ( wrapper . html ( ) ) . toBe ( '<div id="content"></div>' )
564
564
} )
565
565
566
- it ( 'opts in to stubbing keep-alive ' , ( ) => {
566
+ it ( 'opts in to stubbing keep-alive with keep-alive: true ' , ( ) => {
567
567
const spy = vi . spyOn ( console , 'warn' )
568
568
const Comp = {
569
569
template : `<keep-alive><div id="content" /></keep-alive>`
@@ -586,6 +586,52 @@ describe('mounting options: stubs', () => {
586
586
expect ( spy ) . not . toHaveBeenCalled ( )
587
587
} )
588
588
589
+ it ( 'opts in to stubbing KeepAlive with KeepAlive: true' , ( ) => {
590
+ const spy = vi . spyOn ( console , 'warn' )
591
+ const Comp = {
592
+ template : `<KeepAlive><div id="content" /></KeepAlive>`
593
+ }
594
+ const wrapper = mount ( Comp , {
595
+ global : {
596
+ stubs : {
597
+ KeepAlive : true
598
+ }
599
+ }
600
+ } )
601
+
602
+ expect ( wrapper . html ( ) ) . toBe (
603
+ '<keep-alive-stub>\n' +
604
+ ' <div id="content"></div>\n' +
605
+ '</keep-alive-stub>'
606
+ )
607
+ // Make sure that we don't have a warning when stubbing keep-alive
608
+ // https://github.com/vuejs/test-utils/issues/1888
609
+ expect ( spy ) . not . toHaveBeenCalled ( )
610
+ } )
611
+
612
+ it ( 'opts in to stubbing keep-alive with KeepAlive: true' , ( ) => {
613
+ const spy = vi . spyOn ( console , 'warn' )
614
+ const Comp = {
615
+ template : `<keep-alive><div id="content" /></keep-alive>`
616
+ }
617
+ const wrapper = mount ( Comp , {
618
+ global : {
619
+ stubs : {
620
+ KeepAlive : true
621
+ }
622
+ }
623
+ } )
624
+
625
+ expect ( wrapper . html ( ) ) . toBe (
626
+ '<keep-alive-stub>\n' +
627
+ ' <div id="content"></div>\n' +
628
+ '</keep-alive-stub>'
629
+ )
630
+ // Make sure that we don't have a warning when stubbing keep-alive
631
+ // https://github.com/vuejs/test-utils/issues/1888
632
+ expect ( spy ) . not . toHaveBeenCalled ( )
633
+ } )
634
+
589
635
it ( 'does not stub keep-alive with shallow' , ( ) => {
590
636
const Comp = {
591
637
template : `<keep-alive><div id="content" /></keep-alive>`
0 commit comments