diff --git a/docs/api/options.md b/docs/api/options.md index b636aac81..171d465e3 100644 --- a/docs/api/options.md +++ b/docs/api/options.md @@ -107,6 +107,8 @@ shallowMount(Component, { // stub with a specific implementation 'registered-component': Foo, // create default stub + // another-component is the default stub component name + // the default stub is <${default stub component name}-stub> 'another-component': true } }) diff --git a/test/specs/mounting-options/stubs.spec.js b/test/specs/mounting-options/stubs.spec.js index 9fde1810a..16ab5cb4a 100644 --- a/test/specs/mounting-options/stubs.spec.js +++ b/test/specs/mounting-options/stubs.spec.js @@ -174,19 +174,23 @@ describeWithMountingMethods('options.stub', mountingMethod => { expect(HTML).not.to.contain('') }) - it('stubs components with dummy when passed a boolean', () => { - const ComponentWithGlobalComponent = { - render: h => h('div', [h('registered-component')]) - } - const wrapper = mountingMethod(ComponentWithGlobalComponent, { - stubs: { - 'registered-component': true + itDoNotRunIf( + mountingMethod.name === 'renderToString', + 'stubs components with dummy which has name when passed a boolean', () => { + const ComponentWithGlobalComponent = { + render: h => h('div', [h('registered-component')]) } + const wrapper = mountingMethod(ComponentWithGlobalComponent, { + stubs: { + 'registered-component': true + } + }) + const HTML = + mountingMethod.name === 'renderToString' ? wrapper : wrapper.html() + expect(HTML).to.contain('') + expect(wrapper.find({ name: 'registered-component' }).html()) + .to.equal('') }) - const HTML = - mountingMethod.name === 'renderToString' ? wrapper : wrapper.html() - expect(HTML).to.contain('') - }) it('stubs components with dummy when passed as an array', () => { const ComponentWithGlobalComponent = {