Description
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 with role="range"
or role="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 like toHaveValueText
. 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 between toHaveDisplayValue
and toHaveValue
.
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.