-
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
find throws error when using refs #1477
Comments
Without digging my guess is since you are using What happens if you use |
Same issue. Sorry, I should have mentioned that I tried that already as well. |
If it helps, here is where it is failing:
|
Hey I think this is just a limitation of how you are chaining off The problem is, we cant find a Vue component by it's dom node, as that node could have a few components. And we cant search by Vue components, when we go down to DOM level :/ |
That's what I was seeing as well stepping through the code. It's cool, I'm going to try and work up a PR to make the docs more clear that this is a limitation. |
PR here: #1481 |
* docs(wrapper): note exception to chaining find calls Make it clear that when chaining find calls, you can only use DOM selectors. * chore: revert Co-authored-by: Lachlan Miller <[email protected]>
Can this be closed in lue of #1498 ? |
Version
1.0.0-beta.30
Reproduction link
https://gitlab.com/unclejustin/test-utils-but
Steps to reproduce
In a test reference an element by ref. Then try to find anything in that element using anything other than a dom selector:
const button = wrapper.find({ ref: "testButton" });
expect(button.find(Icon).exists()).toBe(true);
This will throw the errror "[vue-test-utils]: cannot find a Vue instance on a DOM node. The node you are calling find on does not exist in the VDom. Are you adding the node as innerHTML?"
What is expected?
That found elements have the same functionality as root wrappers.
What is actually happening?
Throwing an error.
I think this should work as described, but if I am wrong then maybe the docs just need to be updated to reflect the actual functionality?
The text was updated successfully, but these errors were encountered: