Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6214

How to use react-native-testing-library getByRole

$
0
0

I'm trying to use getByRole in react native testing library but can't for the life of me figure out the syntax

Component in question-

<Text   accessibilityRole={'button'}  accessibilityLabel={'upvote count'}  style={[styles.upvoteText, styles.upvoteCount]}>  {upvoteCount}</Text>

and my code

expect(getByRole('button', {name: 'upvote count'} as MatcherOptions)).toBe(2)

Viewing all articles
Browse latest Browse all 6214

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>