-
Notifications
You must be signed in to change notification settings - Fork 264
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
feat: query nested text nodes #293
Conversation
Awesome! Can we add a test please? :) |
src/helpers/getByAPI.js
Outdated
if (child.props.children) { | ||
const { children } = child.props; | ||
|
||
if (children instanceof Array) { |
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.
Don't use instanceof
to check for array. Use .length
src/helpers/getByAPI.js
Outdated
if (children instanceof Array) { | ||
children.forEach(node => { | ||
// eslint-disable-next-line | ||
const { Text } = require('react-native'); |
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.
Text
is retrieved from the caller, let's pass it through function parameters, instead of requiring it in yet another place.
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.
Thank you so much for this contribution! It's a good start and we can make it even better 👍
fd13ac4
to
74eb27c
Compare
Thanks once again! @Trancever will be happy :D |
Summary
Support
*ByText
to match text for nestedText
components.Closes #275
Test plan
Text
, eg<Text/>RN Testing <Text/>Library</Text></Text>
getAllByText