You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there ! I just stumble upon a strange case were testing value for a input type range expect values to be string.
I find it quite odd since those input value are always numbers.
I think it's unfortunate that there is any transformation. I expect toHaveValue to simply match element.value. This has actually led me down a bad path where I assumed I had a number type in my code that was actually a string.
We could have toHaveValueAsNumber that uses element.valueAsNumber.
@testing-library/jest-dom
version: 5.11.9node
version: 12.16.0npm
(oryarn
) version: 1.22.5Relevant code or config:
Hey there ! I just stumble upon a strange case were testing value for a input type range expect values to be string.
I find it quite odd since those input value are always numbers.
Reproduction:
Here is a minimap repro in a codesandbox https://codesandbox.io/s/react-testing-library-demo-forked-pve4d?file=/src/__tests__/hello.js
Problem description:
.toHaveValue
expect string values for input type rangeIt force the test to use strings instead of number. It is annoying when dealing with const that are numbers.
Suggested solution:
.toHaveValue
could expect number values for input type rangeThe text was updated successfully, but these errors were encountered: