user-event
user-event copied to clipboard
clipboardData DataTransferStub.getData should convert format string argument to ASCII lowercase
Reproduction example
https://codesandbox.io/s/happy-dust-ijlfer?file=/src/App.js
Prerequisites
- Render
<input
onPaste={(e) => {
const text = e.clipboardData.getData('Text')
setVal(text)
}}
value={val}
/>
- Paste clipboard data.
Expected behavior
If I call .paste('12345') then DataTransferStub.getData('Text') should return the pasted value of 12345. The format string Text should be converted to lowercase before searching for items. See codesandbox.
Actual behavior
The DataTransferStub.getData('Text') returns ''.
User-event version
14.4.3
Environment
Testing Library framework:
JS framework:
Test environment:
DOM implementation:
Additional context
I found this in the spec https://html.spec.whatwg.org/multipage/dnd.html
Let format be the first argument, converted to ASCII lowercase.
Turns out our production code is using Text 🤷