Skip to content
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

Replace type allAtOnce with "paste" #355

Closed
kentcdodds opened this issue Jun 5, 2020 · 13 comments
Closed

Replace type allAtOnce with "paste" #355

kentcdodds opened this issue Jun 5, 2020 · 13 comments
Assignees
Labels
accuracy Improves the accuracy of how behavior is simulated new event New event to be included in the API

Comments

@kentcdodds
Copy link
Member

It's not aligned with the goals of this lib, but the use case is understandable so we should include a simple "paste" event.

@rbusquet
Copy link

rbusquet commented Jun 6, 2020

Is this a placeholder for a task you already started? I would appreciate it if I could grab this one. Thanks!

@kentcdodds
Copy link
Member Author

kentcdodds commented Jun 6, 2020 via email

@weyert
Copy link

weyert commented Jun 6, 2020

What would be the use case of this? Wouldn’t this be a different use case from typing? I have to admit I never use allAtOnce=true

@kentcdodds
Copy link
Member Author

Yes, it's a different use case. allAtOnce shouldn't exist.

@weyert
Copy link

weyert commented Jun 6, 2020

Ah right, that makes sense, wouldn't making a paste-action make more sense? Similar to clear or the upload actions that are available. I think I added the delay a long time ago so I don't mind that the allAtOnce option gets removed :)

@kentcdodds
Copy link
Member Author

Yeah, that's the point of this issue 😉

@rbusquet
Copy link

rbusquet commented Jun 7, 2020

went through a rabbit hole here. Would it be expected that this event would trigger onpaste event listeners? And what about other clipboard functionalities?

Already learned a lot, I'll continue investigating, but I'm kind of stuck in the lack of support for the clipboard API on jsdom (if we go down the path of dispatching clipboard events). Learning how browsers behave in these cases and how to mock them has been really interesting though.

@kentcdodds
Copy link
Member Author

The goal would be that we fire every event that would be fired in the browser when a user pastes text on an element (including focusing that input).

@nickmccurdy nickmccurdy self-assigned this Jun 10, 2020
@nickmccurdy
Copy link
Member

nickmccurdy commented Jun 11, 2020

@nickmccurdy
Copy link
Member

@rbusquet I think I figured this out mostly, but if you want to experiment/learn about paste events I have a playground

@rbusquet
Copy link

@nickmccurdy thanks! Yeah, I figured I would need more research, thanks for picking this one up.

@nickmccurdy nickmccurdy transferred this issue from testing-library/user-event Jun 14, 2020
@nickmccurdy nickmccurdy transferred this issue from testing-library/dom-testing-library Jun 16, 2020
@nickmccurdy nickmccurdy added accuracy Improves the accuracy of how behavior is simulated new event New event to be included in the API labels Jun 16, 2020
@nickmccurdy
Copy link
Member

nickmccurdy commented Jun 17, 2020

This was partially implemented in #348 (which was ported from testing-library/dom-testing-library#645), but I still have some more work in progress from the todo list. I'll close this when I either fix the todos or extract them into separate issues.

@ph-fritsche
Copy link
Member

The initial issue seems to be resolved.
Extended support for paste events as well as simulating the Clipboard API for environments (jsdom) not implementing it might be worth discussing in a new issue.
If anyone could collect the necessary information about the necessary changes in a new issue, that would be great. 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accuracy Improves the accuracy of how behavior is simulated new event New event to be included in the API
Projects
None yet
Development

No branches or pull requests

5 participants