-
Notifications
You must be signed in to change notification settings - Fork 473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(userEvent): Add paste API (fixes #640) #645
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments, but I just had a thought... What if instead we make a {paste}
modifier inside type
? This would simplify the implemention quite a bit and honestly makes plenty of sense as an API to me personally.
Shouldn't the typing modifiers be primarily for individual key presses and modifiers? I feel like pasting has different enough responsibilities from typing semantically to be a separate function, just like how clear and tab are functions rather than modifiers. Either way, I'm interested if we could maybe make paste use type more directly to simplify the architecture, as I originally though that wouldn't be possible after removing the |
Not really. We already have |
It still feels like a different kind of user interaction to me. At least |
Fair point 👍 ok, let's proceed with sharing code instead. |
Ok, because of the decision to not merge user-event right now, I've back-ported all my improvements to user-event into testing-library/user-event#348, and I included this as well. I hope you don't mind 😬 Thanks! |
This wasn't ready to release, can we revert it? |
I made it ready 😁 |
Tracking followup work back in testing-library/user-event#355 |
Migrated from testing-library/user-event#343
What: Add paste API (fixes #640)
Why: The
allAtOnce
option oftype
doesn't represent real user interaction intuitively, and we need to firepaste
events with the relevantclipboardData
How:
paste
event from old code fortype
'sallAtOnce
optionclipboardData
support SupportclipboardData
likedataTransfer
. #585paste
withclipboardData
input
with matching valuefocus
DataTransfer
mock objectsChecklist:
docs site N/A