@@ -128,6 +128,52 @@ describeWithMountingMethods('options.stub', mountingMethod => {
128
128
expect ( HTML ) . to . contain ( '<registered-component-stub>' )
129
129
} )
130
130
131
+ itDoNotRunIf (
132
+ mountingMethod . name === 'shallowMount' ,
133
+ 'stubs nested components' , ( ) => {
134
+ const GrandchildComponent = {
135
+ template : '<span />'
136
+ }
137
+ const ChildComponent = {
138
+ template : '<grandchild-component />' ,
139
+ components : { GrandchildComponent }
140
+ }
141
+ const TestComponent = {
142
+ template : '<child-component />' ,
143
+ components : { ChildComponent }
144
+ }
145
+ const wrapper = mountingMethod ( TestComponent , {
146
+ stubs : [ 'grandchild-component' ]
147
+ } )
148
+ const HTML = mountingMethod . name === 'renderToString'
149
+ ? wrapper
150
+ : wrapper . html ( )
151
+ expect ( HTML ) . not . to . contain ( '<span>' )
152
+ } )
153
+
154
+ itDoNotRunIf (
155
+ mountingMethod . name === 'shallowMount' ,
156
+ 'stubs nested components on extended components' , ( ) => {
157
+ const GrandchildComponent = {
158
+ template : '<span />'
159
+ }
160
+ const ChildComponent = {
161
+ template : '<grandchild-component />' ,
162
+ components : { GrandchildComponent }
163
+ }
164
+ const TestComponent = {
165
+ template : '<div><child-component /></div>' ,
166
+ components : { ChildComponent }
167
+ }
168
+ const wrapper = mountingMethod ( Vue . extend ( TestComponent ) , {
169
+ stubs : [ 'grandchild-component' ]
170
+ } )
171
+ const HTML = mountingMethod . name === 'renderToString'
172
+ ? wrapper
173
+ : wrapper . html ( )
174
+ expect ( HTML ) . not . to . contain ( '<span>' )
175
+ } )
176
+
131
177
it ( 'stubs components with dummy when passed a boolean' , ( ) => {
132
178
const ComponentWithGlobalComponent = {
133
179
render : h => h ( 'div' , [ h ( 'registered-component' ) ] )
0 commit comments