Skip to content

Dynamic components are not stubbed by stubs provided in mounting options #1206

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

Closed
peterkajan opened this issue Apr 11, 2019 · 6 comments
Closed

Comments

@peterkajan
Copy link

Version

1.0.0-beta.29

Reproduction link

https://codesandbox.io/s/54j8o43z3l?fontsize=14&module=%2Ftest%2Fshallow-mount.spec.js

Steps to reproduce

Open the reproduction link and see the failing test

What is expected?

ChildComponent to be stubbed with the stub provided in Mounting options:

<div>
  <div class="stubFromOptions" />
</div>

What is actually happening?

ChildComponent is stubbed by the automatic stub:

<div>
  <childcomponent-stub></childcomponent-stub>
</div>
@dsseng
Copy link
Contributor

dsseng commented Apr 21, 2019

@peterkajan it'll work if you set dataComponent: 'ChildComponent', not pass component directly to data. If you set it in data, you should stub it yourself after mount.

@peterkajan
Copy link
Author

Thanks, this works. Not sure if this is only a workaround or the solution. Maybe little more detailed explanation would help.

@dcrystalj
Copy link

@peterkajan @sh7dm can you show solution. I was not able to fix your example

@peterkajan
Copy link
Author

Here there is fixed version of the test: https://codesandbox.io/s/54j8o43z3l?fontsize=14&module=%2Ftest%2Fshallow-mount-fixed.spec.js

The change is on line 19:
dataComponent: ChildComponent -> dataComponent: "ChildComponent"

@M3psipax
Copy link

Would like to bump this. I encountered this issue as well and it's not feasible for me to change the component assignments to strings. Can we get an update on whether this is going to be fixed any time soon?

@ebisbe
Copy link
Collaborator

ebisbe commented Feb 15, 2023

#1564 (comment)

@ebisbe ebisbe closed this as completed Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants