Skip to content

Conversation

hduprat
Copy link
Contributor

@hduprat hduprat commented Nov 26, 2019

Summary

When the number 0 is integrated into a component via a variable, getByText('0') does not find any Text instance.

Examples

Example.jsx:

const test = 0;
...
<Text>{test}</Text>

Example.test.jsx:

const testInstance = render(<Example/>);
getByText('0'); // throws whereas it should not, as there is a 0 in a text component

Test plan

A test has been added in render.test.js

@thymikee thymikee requested a review from Esemesek November 26, 2019 17:18
// In some cases child might be undefined
child => (child ? child.toString() : '')
// In some cases child might be undefined or null
child => (child !== undefined && child !== null ? child.toString() : '')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
child => (child !== undefined && child !== null ? child.toString() : '')
child => (child ?? child.toString() : '')

@thymikee thymikee merged commit 0840d44 into callstack:master Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants