Skip to content

Commit 97b505d

Browse files
38elementseddyerburgh
authored andcommitted
docs: improve docs/api/options.md (#735)
1 parent daa56aa commit 97b505d

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

Diff for: docs/api/options.md

+2
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ shallowMount(Component, {
107107
// stub with a specific implementation
108108
'registered-component': Foo,
109109
// create default stub
110+
// another-component is the default stub component name
111+
// the default stub is <${default stub component name}-stub>
110112
'another-component': true
111113
}
112114
})

Diff for: test/specs/mounting-options/stubs.spec.js

+15-11
Original file line numberDiff line numberDiff line change
@@ -174,19 +174,23 @@ describeWithMountingMethods('options.stub', mountingMethod => {
174174
expect(HTML).not.to.contain('<span>')
175175
})
176176

177-
it('stubs components with dummy when passed a boolean', () => {
178-
const ComponentWithGlobalComponent = {
179-
render: h => h('div', [h('registered-component')])
180-
}
181-
const wrapper = mountingMethod(ComponentWithGlobalComponent, {
182-
stubs: {
183-
'registered-component': true
177+
itDoNotRunIf(
178+
mountingMethod.name === 'renderToString',
179+
'stubs components with dummy which has name when passed a boolean', () => {
180+
const ComponentWithGlobalComponent = {
181+
render: h => h('div', [h('registered-component')])
184182
}
183+
const wrapper = mountingMethod(ComponentWithGlobalComponent, {
184+
stubs: {
185+
'registered-component': true
186+
}
187+
})
188+
const HTML =
189+
mountingMethod.name === 'renderToString' ? wrapper : wrapper.html()
190+
expect(HTML).to.contain('<registered-component-stub>')
191+
expect(wrapper.find({ name: 'registered-component' }).html())
192+
.to.equal('<registered-component-stub></registered-component-stub>')
185193
})
186-
const HTML =
187-
mountingMethod.name === 'renderToString' ? wrapper : wrapper.html()
188-
expect(HTML).to.contain('<registered-component-stub>')
189-
})
190194

191195
it('stubs components with dummy when passed as an array', () => {
192196
const ComponentWithGlobalComponent = {

0 commit comments

Comments
 (0)