-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
How to find an element based on its ref attribute? #82
Comments
As a workaround, I added an ID/className to my elements, so I had something to use as an argument to |
I don't think this will be covered by #70 (should probably double check though). This is because refs are special. @marlonbernardes there is a |
@lelandrichardson thanks for the information! I did not know about this method because it's not present on the documentation. I just opened a new issue, to document the Using |
Error: ReactWrapper::ref(refname) can only be called on the root 👎 |
@marlonbernardes .ref() doesn't return a wrapper |
When refactoring my tests to use enzyme, I wanted to find some elements based on their ref attribute. Is there a way to achieve that?
Lets say I have this component (it's just a made-up example):
How do I find the
second-button
using its ref attribute?Is implementing a
ref([key])
method a good/viable idea?I could help if you think this is something worth to have.
The text was updated successfully, but these errors were encountered: