testing-library / testing-library/user-event
userEvent.paste possibly casts string to a number
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 258
- PR merge metrics
- No merged PRs in 30d
Description
Reproduction example
https://codesandbox.io/s/happy-architecture-1crzb7?file=/src/App.test.js
Prerequisites
- Go to
Teststab and run the test - Notice that the test fails due to mismatched paste value
- If you check console log of
App, the rawe.target.valueequals to0.8(instead of.80)
Expected behavior
userEvent.paste should return .80.
Actual behavior
userEvent.paste returns 0.8 (was somehow cast to a number?).
User-event version
14.4.3
Environment
N/A. Can be reproduced in codesandbox.
Additional context
This used to work in v13+. Please see repro below.
https://codesandbox.io/s/hungry-wildflower-e5o25n?file=/src/App.test.js
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 reproduction in App.test.js and the userEvent.paste entry point, comparing the v14.4.3 behavior with the v13 reproduction. Add a regression test showing that pasted .80 remains .80, then run the relevant user-event tests and confirm the raw target value is preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100