Skip to content

Conversation

@JimSchofield
Copy link

I had to write this for one of my projects, and thought it would be helpful to include.

Tries to support the dataTransfer part of the drag, as that seems to be the most important thing with drag events.

I did not model drag events as a MouseEvent because keeping it a basic event is the simplest, however they are truly mouse events so it may be worth putting it under that umbrella in the code in the future.

@JimSchofield
Copy link
Author

I tried to refactor the event listeners in the test to make sure it works with ember 3.8. I'm not sure how Ember did event listeners before {{on ...}} so I hope that works? 😁

@JimSchofield
Copy link
Author

JimSchofield commented Nov 5, 2021

@MelSumner @rwjblue wondering if there's time to review this?

Copy link
Contributor

@MelSumner MelSumner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me but I'd like to have @rwjblue review it for consistency. Thank you for doing this work! 👍

@MelSumner MelSumner requested review from Turbo87 and locks January 28, 2022 07:24
@locks
Copy link
Contributor

locks commented Aug 4, 2023

@JimSchofield hi! do you have some time to resolve the conflicts?

JimSchofield and others added 4 commits August 4, 2023 12:49
moveDrag allows a user to simulat drag and drop events (https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API)

This implementation allows the user to access dataTransfer on the event
to simulate setting data to be transfered to the receiving event
handler.
@JimSchofield
Copy link
Author

I spent some time today trying to rebase of of master here. I think I fixed the conflicts, but we're getting behavior changes and the tests are failing. I'm noticing that options being passed into fireEvent are missing when the event is called. Specifically, when I mock the DataTransfer object to allow setting and getting values this object seems to disappear after the event is fired. Perhaps this has to do with making fireEvent return a promise? But I have to visit this another time.

@JimSchofield JimSchofield force-pushed the add-drag-and-drop-support branch from 3f850e0 to 0ae894a Compare August 4, 2023 18:08
runHooks('dragMove', 'start', draggableStartElement, dropTargetElement)
)
.then(() => {
.then(async () => {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a naive try to get it to work as it was before the fireEvent change.

@NullVoxPopuli
Copy link
Collaborator

hello! sorry for not looking at this PR sooner -- would you be willing to rebase?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants