-
Notifications
You must be signed in to change notification settings - Fork 403
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
Support range
widgets in toHaveDisplayValue
#441
Comments
I just landed here trying to figure out how to assert that an indeterminate progressbar is accessible. These should be the correct tags for it, but jest-dom doesn't seem to recognize any of them for toHaveDisplayValue, toHaveAccessibleDescription, or even toHaveTextContent
|
This issue is about |
The issue appears, to me, to be about the behavior of
Yes the issue title explicitly mentions range elements, but the point I'm making is that the bug is with the aria property not being handled correctly, regardless of the element being used. Perhaps this issue could be renamed? |
The
A progress bar, or a |
Describe the feature you'd like:
As far as I understand it, the
toHaveDisplayValue
matcher takes some kind of input element and computes the value that the user can see.However, it does not work properly for
range
widgets (e.g.<input type="range">
, but also elements withrole="range"
orrole="slider"
).According to the standard, the
aria-valuetext
attribute should be rendered when provided. If not,aria-valuenow
should be used (which is implicitly set for<input type="range">
elements to their value).I think it would be a good addition to support range widgets with the
toHaveDisplayValue
matcher.Suggested implementation:
We need some way to calculate the element's value text if it is a range widget. I'm not sure if this should be done here or in the
dom-accessibility-api
. But probaply there.Then we just need to extend the matcher to also accept range widgets and use the value text for comparison.
Describe alternatives you've considered:
I'm actually not sure if the
toHaveDisplayValue
matcher would be the best fit. Maybe an additional matcher would make sense. Something liketoHaveValueText
. That would be confusing to me personally however since I would not be very sure which one to use when. I think this is already a problem with the difference betweentoHaveDisplayValue
andtoHaveValue
.Teachability, Documentation, Adoption, Migration Strategy:
I don't really know what to write here, but I think that range widgets are not that uncommon and it would be cool to be able to test the value of them in the same way we can test things like selects.
The text was updated successfully, but these errors were encountered: