Skip to content

Named slots' content is not generated for stubbed components via shallowMountΒ #1307

@chriswa

Description

@chriswa

What problem does this feature solve?

Higher-order components make use of named slots. It's possible to test higher-order components via shallowMount because named slot content can be mocked, but it's not possible to test components which consume higher-order components because their generated named slot output is not available in the stubbed content.

#782 added support for outputting default slot content, but not named slots.

To be clear, an example of a component which needs this support is:

<!-- myComponent.vue -->
<template>
  <HigherOrderComponent foo="bar">
    default slot content
    <template v-slot="header">header slot content</template>
    <template v-slot="footer">footer slot content<HigherOrderComponent foo="waldo"/></template>
  </HigherOrderComponent>
</template>

Currently, this is stubbed out to only:

<higherordercomponent-stub foo="bar">default slot content</higherordercomponent-stub>

The end user experience should be that components which generate named slot content "just work" when testing with shallowMount.

What does the proposed API look like?

The API would not change.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions