-
Notifications
You must be signed in to change notification settings - Fork 258
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
Bug: Scoped slots always undefined when shallow mounting and renderStubDefaultSlot
is enabled
#2395
Labels
bug
Something isn't working
Comments
cexbrayat
added a commit
to cexbrayat/vue-test-utils-next
that referenced
this issue
Apr 4, 2024
Fixes vuejs#2395 We now explicitely call the default slot with an empty object to ensure that `<ComponentWithSlot v-slot="{ count }">` won't throw when tested with `renderStubDefaultSlot` `renderStubDefaultSlot`.
cexbrayat
added a commit
to cexbrayat/vue-test-utils-next
that referenced
this issue
Apr 4, 2024
Fixes vuejs#2395 We now explicitely call the default slot with an empty object to ensure that `<ComponentWithSlot v-slot="{ count }">` won't throw when tested with `renderStubDefaultSlot` `renderStubDefaultSlot`.
Hi @tom751 Thanks for the repro. |
cexbrayat
added a commit
to cexbrayat/vue-test-utils-next
that referenced
this issue
Apr 4, 2024
Fixes vuejs#2395 We now explicitely call the default slot with an empty object to ensure that `<ComponentWithSlot v-slot="{ count }">` won't throw when tested with `renderStubDefaultSlot`.
cexbrayat
added a commit
to cexbrayat/vue-test-utils-next
that referenced
this issue
Apr 4, 2024
Fixes vuejs#2395 We now explicitely call the default slot with an empty object to ensure that `<ComponentWithSlot v-slot="{ count }">` won't throw when tested with `renderStubDefaultSlot`.
cexbrayat
added a commit
to cexbrayat/vue-test-utils-next
that referenced
this issue
Apr 5, 2024
Fixes vuejs#2395 We now explicitely call the default slot with an empty object to ensure that `<ComponentWithSlot v-slot="{ count }">` won't throw when tested with `renderStubDefaultSlot`.
cexbrayat
added a commit
that referenced
this issue
Apr 5, 2024
Fixes #2395 We now explicitely call the default slot with an empty object to ensure that `<ComponentWithSlot v-slot="{ count }">` won't throw when tested with `renderStubDefaultSlot`.
nazarepiedady
pushed a commit
to nazarepiedady/vue-test-utils-v2
that referenced
this issue
Jul 18, 2024
Fixes vuejs#2395 We now explicitely call the default slot with an empty object to ensure that `<ComponentWithSlot v-slot="{ count }">` won't throw when tested with `renderStubDefaultSlot`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When
renderStubDefaultSlot
is enabled, if youshallowMount
a component that renders another component that has a scoped slot, then an error is thrown stating that the slot is undefined. This used to work on vue test utils v1, and is making my current Vue 2.7 > 3 migration quite difficult.To Reproduce
TLDR Here's an example repo https://github.com/tom751/vtu-slot-issue - The
HelloWorld.spec.ts
will failHave a component that renders a child component that has a scoped slot:
Render the component with
shallowMount
andrenderStubDefaultSlot
enabledThe following error is thrown after running the test:
Expected behavior
An error shouldn't be thrown, the behaviour should be the same as it is in Vue 2 + vue test utils v1
Related information:
Additional context
This used to work in Vue 2.7 and vue test utils v1
The text was updated successfully, but these errors were encountered: