-
Notifications
You must be signed in to change notification settings - Fork 249
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
Simulate drag and drop #440
Comments
I'm all for it, though you should wait for a member position on this before to spend time on the implementation. Are those all the events triggered by a drag event? Cypress can help us with that, I make do with it for some drag test I did in the past. |
Yeah, for this kind of thing I think that Cypress is the place to go. Simulating drag-and-drop in an environment which does not support layout like jsdom (which is where most people use user-event) would be very tricky to get legit confidence from. |
Thank you for your answers! I didn't know about this jsdom limitation until now. We're not using cypress at the moment but perhaps it is time we do. |
Do you still feel strongly about this @kentcdodds ? I have written quite a few tests with jest and jsdom to make sure logic related to dnd actions works as expected and I'm happy with the confidence they give me.
|
If you're happy with it then fell free to continue doing it that way. I personally wouldn't want components that really heavily on layout to have that important aspect of their behavior mocked. |
So I assume that's a |
That's a: "I don't think I would use it, but some people like yourself and others who use user-event in a real browser might. This means I'll accept a pull request for it, but I won't maintain it." 😅 |
haha that sounds good to me! Thanks |
That is a great addition. One can use this to test that drag&drop implementations work in principle. We should just alert everyone in the documentation that the coordinates received for the PointerEvents are not reliable and that the test does not verify if a drag operation can be actually performed by the user because the source or target element might be hidden. It would be great if the first argument of |
@ipap360 Thanks for the example code! |
Hi everyone, I would like to know how I would test just the drag, when I drag an input file it changes the style and I wanted to test this, without executing the drop |
We have some a custom drag-n-drop multi select form control in our project and we've added a small helper to simulate drag and drop events (we found the code posted somewhere and we tweaked it a bit). Our project is using React DnD but I believe that the helper would apply to any generic html5 DnD implementation.
I wonder whether this is something that would be useful to add and maintain here.
Relevant code or config
The text was updated successfully, but these errors were encountered: