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
When changing an element in UI, the browser updates element.validity. user-event maintains the UI value as it diverges from the IDL value, but it does not update element.validity accordingly.
My team is also suffering with this problem on a HTML 5 date field. In the browser you can partially fill out a date whereas in react testing library we can only input complete dates.
We have worked around the problem by extracting the function and testing it in isolation but its not an ideal solution.
// THIS IS A LIMITATION OF THE BROWSER
// It is impossible to programmatically set an input
// value to an invlid value. Not sure how to work around this
Problem description:
When changing an element in UI, the browser updates
element.validity
.user-event
maintains the UI value as it diverges from the IDL value, but it does not updateelement.validity
accordingly.There was a test asserting this behavior:
user-event/tests/type/index.ts
Lines 531 to 542 in a747b0a
Suggested solution:
Implement
ValidityState
and update it when changing UI value.The text was updated successfully, but these errors were encountered: