toBeVisible is an example in the docs, but is not a jest-native matcher
mikelros opened this issue · 2 comments
The docs have toBeVisible as a jest-native matcher example as shown below:
<View>
<View testID="not-empty">
<Text testID="empty" />
</View>
<Text testID="visible">Visible Example</Text>
</View>;
expect(queryByTestId(baseElement, 'not-empty')).not.toBeEmpty();
expect(getByText(baseElement, 'Visible Example')).toBeVisible();
Are there any plans on implementing that matcher? It would be great having another matcher as an example until toBeVisible is implemented.
Thanks in advance!
Thanks for pointing this out, as far as the docs go, that example should be updated to reflect a real example of an existing matcher 👍 would you like to help fix it with a better example?
As far as the matcher goes, I’d be happy to look at a PR or RFC in jest-native if you can think of a good way to do it. The reason I didn’t is because visibility in react native isn’t as straightforward as the DOM, and I couldn’t think of a way to reliably determine it. The suggested approach in react native is to not render an element at all, rather than hiding it, but that said I’d love to see some ideas!
Docs updated: 0e7e29c