-
Notifications
You must be signed in to change notification settings - Fork 669
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
Test child component, which is the root element #2070
Comments
Bumping this, still a issue after VTU v1 with no clear solution, despite previous issues being seemingly closed as resolved. The old workaround of using |
It seems two possible workarounds for this behaviour are either:
Note: using $attrs seems to maintain the original property types unlike |
Hi,
If using
this will return the root wrapper itself of my component under test. |
Subject of the issue
Example:
Lets say I have the following parent component:
When unit testing my ParentComponent I want to check the correct usage of the underlying ChildComponent as well and test its properties. Back in Vue2 I normally did:
I used the
wrapper.vm.$children[0]
approach, becausewrapper.find(ChildComponent)
would return the same wrapper again. (because it is the root)Now my question is: How can I select the child-component in Vue3 to tests its properties?
Steps to reproduce
Tell us how to reproduce this issue. Please provide a working and simplified example.
Expected behaviour
What should happen?
Actual behaviour
What happens instead?
Possible Solution
What are the alternative solutions? Please describe what else you have considered?
The text was updated successfully, but these errors were encountered: