testing-library / testing-library/user-event
Update ValidityState when editing values
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 258
- PR merge metrics
- No merged PRs in 30d
Description
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 update element.validity accordingly.
There was a test asserting this behavior:
https://github.com/testing-library/user-event/blob/a747b0ab07681651bf6b6428471de2dd76bc22df/tests/type/index.ts#L531-L542
Suggested solution:
Implement ValidityState and update it when changing UI value.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the validity behavior test in tests/type/index.ts at the linked lines, then trace how user-event maintains the UI value separately from the IDL value. Run the relevant type tests and update them so element.validity reflects edited values; done when the validity assertions pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100