diff --git a/packages/shared/stub-components.js b/packages/shared/stub-components.js index 57220755b..8dd893e9d 100644 --- a/packages/shared/stub-components.js +++ b/packages/shared/stub-components.js @@ -100,7 +100,10 @@ function createBlankStub (originalComponent: Component, name: string) { return { ...getCoreProperties(componentOptions), render (h) { - return h(tagName) + return h( + tagName, + !componentOptions.functional && this.$slots.default + ) } } } diff --git a/test/specs/mounting-options/stubs.spec.js b/test/specs/mounting-options/stubs.spec.js index 16ab5cb4a..7cc7ce908 100644 --- a/test/specs/mounting-options/stubs.spec.js +++ b/test/specs/mounting-options/stubs.spec.js @@ -174,6 +174,25 @@ describeWithMountingMethods('options.stub', mountingMethod => { expect(HTML).not.to.contain('') }) + it('renders slot content in stubs', () => { + const TestComponent = { + template: ` +
+ + + +
+ ` + } + const wrapper = mountingMethod(TestComponent, { + stubs: ['child-component', 'stub-with-child'] + }) + const HTML = mountingMethod.name === 'renderToString' + ? wrapper + : wrapper.html() + expect(HTML).to.contain('') + }) + itDoNotRunIf( mountingMethod.name === 'renderToString', 'stubs components with dummy which has name when passed a boolean', () => { @@ -320,19 +339,20 @@ describeWithMountingMethods('options.stub', mountingMethod => { 'stubs on child components', () => { const TestComponent = { - template: '' + template: '' } - const wrapper = mountingMethod( { components: { 'test-component': TestComponent }, template: '' }, { - stubs: ['transition'] + stubs: { + 'transition': 'time' + } } ) - expect(wrapper.find('span').exists()).to.equal(false) + expect(wrapper.find('time').exists()).to.equal(false) } )