Missing .toHaveLabelText
and .toHaveRole
?
#424
SevenOutman
started this conversation in
General
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I have been always wondering what is the correct way to test that an element has a specific ARIA role (explicitly or implicitly).
Say I'm implementing this
<Radio>
component which is expected to render an ARIAradio
along with alabel
associated with it. Yes I can usegetByRole('radio')
to check that aradio
is rendered, but I can't tell whether it's got the expected label text. And yes I can usegetByLabelText('text')
to check that something with expected label text is rendered, but I can't tell whether it's aradio
.Here's what I can do so far:
Just as I was writing this comment I realized that I can do this:
But still posting this in case someone has same question with me.
Beta Was this translation helpful? Give feedback.
All reactions