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
Do you have a sample test ? #29
Comments
It's in the examples folder in the repo. And the README has link to live demo for the same code. |
AFAIK the examples folder only contains demos - not tests. I'm looking for code to use for writing my own tests testing the dnd interactions. |
Ah, I get it now. No, this project has no tests. We use it extensively in production though. If you find a meaningful way to test it (a lot of its logic has to do with browser differences, for example), please let me know! |
I'm mainly looking for ways to simulate drag and drop, but I'll let you 2015-01-04 14:49 GMT+01:00 Dan Abramov notifications@github.com:
Tarjei Huse |
I'm just not familiar with React testing infrastructure. If it allows simulating dragstart / dragover / dragend you'll be fine. If not, maybe you can suggest some way in which I can add test helpers. I'm just not sure what kind of API is needed there. |
I would also be interested in this. But at an even more basic level, how would you propose writing a simple unit test for a component that uses the DragDropMixin? This is a fantastic library, by the way. I'm using it for some production code, but I'm required to write some unit tests for code using it. |
Thanks! We can probably go two routes here:
Which is closer to what you'd like to test? Do you run your tests in a browser or in some fake DOM env? (Disclaimer: I never wrote tests for UI in my life and know very little about it.) |
I'm using jest by facebook right now and i believe jest tests run in a virtual DOM. |
Can you share a minimal Jest example for the kind of thing you'd like to test? |
i think it would be great if there's some way to determine whether a component is being dragged, dropped, etc. so, if a test could do something like
I'm not sure if this is a great example, as I am really new to UI testing, myself. |
So, using Jest, I was able to test drag and drop functionality with this function. I used React's
|
Hmm.. I think you should just add whatever stuff necessary to make it work and see :-) |
not at the moment. i will get back to you if something comes up or if i come up with a better solution. |
Closing, as it's not really an issue. We will try to make the testing story better after v1.0 with #55. |
Testing is now supported, even without the browser: http://gaearon.github.io/react-dnd/docs-testing.html |
Great work - and a brilliant component! Thanks! 2015-05-19 14:11 GMT+02:00 Dan Abramov notifications@github.com:
Tarjei Huse |
looks great! |
Hi, do you have a sample code for testing a drag and drop interaction?
The text was updated successfully, but these errors were encountered: