-
Notifications
You must be signed in to change notification settings - Fork 668
Slots are not rendered in snapshot when they are in v-expansion-panel of Vuetify #887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We currently only render default slots for stubbed components The change you're requesting would mean that we render every named slot component. I'll investigate. |
I was interested in this myself, and here was my solution: Modifying https://github.com/vuejs/vue-test-utils/blob/dev/packages/shared/stub-components.js#L96 export function createBlankStub (
originalComponent: Component,
name: string
): Component {
const componentOptions = typeof originalComponent === 'function'
? originalComponent.extendOptions
: originalComponent
const tagName = `${name}-stub`
// ignoreElements does not exist in Vue 2.0.x
if (Vue.config.ignoredElements) {
Vue.config.ignoredElements.push(tagName)
}
return {
...getCoreProperties(componentOptions),
render (h, context) {
let innerContent = null
if (context) {
innerContent = context.children
} else {
innerContent = Object.keys(this.$slots).map(slotName => {
const slot = this.$slots[slotName]
if (slotName !== 'default') {
return slot
} else {
const element = h('div', { class: `${slotName}-slot` }, slot)
return element
}
})
}
return h(
tagName,
{
attrs: componentOptions.functional ? {
...context.props,
...context.data.attrs,
class: createClassString(
context.data.staticClass,
context.data.class
)
} : {
...this.$props
}
},
innerContent
)
}
}
} Thoughts?? |
@ferm10n yes that looks good 👍 Do you want to make a PR? |
This issue causes huge problems for me, because most of my component tests are broken or useless because of this. I have Vuetify components nested into each other and I also want to test if the correct content is rendered is into them. |
Version
1.0.0-beta.22
Reproduction link
https://codesandbox.io/s/43k3520wmw
Steps to reproduce
Slots are not rendered in snapshot when they are in v-expansion-panel of Vuetify
What is expected?
What is actually happening?
The text was updated successfully, but these errors were encountered: