Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/shared/stub-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ function createBlankStub (originalComponent: Component) {
return {
...getCoreProperties(originalComponent),
render (h) {
return h(name)
return h(`${originalComponent.name}-stub`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line does not need to change.

const name = `${originalComponent.name}-stub`

!originalComponent.functional && this.$slots.default
)
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions test/specs/mounting-options/stubs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,25 @@ describeWithMountingMethods('options.stub', mountingMethod => {
}
)

it('renders slot content in stubs', () => {
const TestComponent = {
template: `
<div>
<stub-with-child>
<child-component />
</stub-with-child>
</div>
`
}
const wrapper = mountingMethod(TestComponent, {
stubs: ['child-component', 'stub-with-child']
})
const HTML = mountingMethod.name === 'renderToString'
? wrapper
: wrapper.html()
expect(HTML).to.contain('<child-component-stub>')
})

it('stubs components on component if they do not already exist', () => {
const ComponentWithGlobalComponent = {
render: h => h('registered-component')
Expand Down