@@ -64,18 +64,18 @@ describeWithMountingMethods('options.stub', mountingMethod => {
64
64
mountingMethod . name === 'renderToString' ,
65
65
'replaces component with a component' ,
66
66
( ) => {
67
+ const mounted = sinon . stub ( )
68
+ const Stub = {
69
+ template : '<div />' ,
70
+ mounted
71
+ }
67
72
const wrapper = mountingMethod ( ComponentWithChild , {
68
73
stubs : {
69
- ChildComponent : {
70
- render : h => h ( 'time' ) ,
71
- mounted ( ) {
72
- console . info ( 'stubbed' )
73
- }
74
- }
74
+ ChildComponent : Stub
75
75
}
76
76
} )
77
- expect ( wrapper . findAll ( Component ) . length ) . to . equal ( 1 )
78
- expect ( info . calledWith ( 'stubbed' ) ) . to . equal ( true )
77
+ expect ( wrapper . findAll ( Stub ) . length ) . to . equal ( 1 )
78
+ expect ( mounted ) . calledOnce
79
79
}
80
80
)
81
81
@@ -567,4 +567,28 @@ describeWithMountingMethods('options.stub', mountingMethod => {
567
567
)
568
568
expect ( HTML ) . to . contain ( 'h1' )
569
569
} )
570
+
571
+ itDoNotRunIf (
572
+ mountingMethod . name === 'renderToString' ,
573
+ 'uses original component stub' , ( ) => {
574
+ const Stub = {
575
+ template : '<div />'
576
+ }
577
+ const ToStub = {
578
+ template : '<div />'
579
+ }
580
+ const TestComponent = {
581
+ template : '<div><to-stub /></div>' ,
582
+ components : {
583
+ ToStub
584
+ }
585
+ }
586
+ const wrapper = mountingMethod ( TestComponent , {
587
+ stubs : {
588
+ ToStub : Stub
589
+ }
590
+ } )
591
+ expect ( wrapper . find ( ToStub ) . exists ( ) ) . to . be . false
592
+ expect ( wrapper . find ( Stub ) . exists ( ) ) . to . be . true
593
+ } )
570
594
} )
0 commit comments