testing-library / testing-library/user-event
userEvent.paste is case-sensitive
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/pensive-morning-5fttk8?file=/src/App.js
Prerequisites
- Render element
- add
on pastelistener withevent.clipboardData?.getData('Text') - call
userEvent.paste('hello')
Expected behavior
event.clipboardData?.getData('Text') returned hello
Actual behavior
event.clipboardData?.getData('Text') returned undefined
User-event version
14.5.1
Environment
No response
Additional context
I noticed an issue with userEvent.paste in the following case.
Nevertheless, in the browser, such code works. After examining the Chromium source code, I confirmed this. Chrome intentionally converts the data type name to lowercase. It seems more appropriate to implement similar logic on the userEvent side.
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 by locating the userEvent.paste implementation and its existing tests, then reproduce the reported input and clipboard listener behavior from the issue. The change is done when clipboard data type lookup treats 'Text' like the browser does and the regression is covered by a passing test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100