-
Notifications
You must be signed in to change notification settings - Fork 668
findComponent throws an error when used on functional wrapper #1577
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
Comments
I have the same problem |
Same issue here. |
For some reason, it still threw me an error on this code when finding the wrapper by querying a parent element of the nested component.
However, this one worked out perfectly fine.
|
You cannot find a component from a DOM element (eg, Just do |
@lmiller1990 I'm actually seeing this same error when chaining findComponent and findComponent
EDIT |
You may need to share some code. Basically functional components do not have an instance so |
Subject of the issue
When testing a functional component, findComponent to search for components rendered inside throws an error claiming that the component is a DOM element.
Steps to reproduce
Considering the following component, where
BaseIcon
is a component that renders an icon.Edit: The inner workings of BaseIcon are not really meaningful, any component that is returned in the render function seems to cause the same problem.
When running test:
The following error occurs:
Expected behaviour
VTU should recognize that the wrapper is a functional component, and not a DOM element, so that I can chain
findComponent
on it.Actual behaviour
VTU thinks that the functional component is a DOM element, which makes the use of
findComponent
an error.Additionally, when trying to use
find
instead, it also errors out sinceBaseIcon
is a component.Possible Solution
🤷♀️ No clue, sorry :D
The text was updated successfully, but these errors were encountered: