-
Notifications
You must be signed in to change notification settings - Fork 273
fix: Return closest Text matching a query #489
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
fix: Return closest Text matching a query #489
Conversation
b5be945
to
0bdab5d
Compare
@thymikee Is there anything I could do to help this PR to move forward? It prevents us from upgrading to the latest version :/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice edge case handling.
I've added two minor suggestions to improve the code comments & test.
Co-authored-by: Maciej Jastrzebski <[email protected]>
Thank you @AugustinLF ! |
Thanks a lot, was a pleasure to help get that in, thanks for the final fixes! |
Summary
When using
getByText()
on a component using nestedText
s, it should match the closest one.I've found this bug when trying to upgrade from
@5.X
to@7.X
, this breaks one of my tests where anonPress
handler is attached to the lower Text, and sincegetByText
returns its parent, usingfireEvent.press(getByText('My text'))
doesn't work.Test plan
The added tests should show the covered case. I added an another test to be sure I would not introduce a regression.