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

Add dragenter event and test to drag_to #2601

Closed
wants to merge 1 commit into from
Closed

Add dragenter event and test to drag_to #2601

wants to merge 1 commit into from

Conversation

matt17r
Copy link
Contributor

@matt17r matt17r commented Oct 19, 2022

Fire a dragenter event before the two dragover events.

The spec requires a dragenter event to be fired first:

To accept a drop, the drop target has to listen to at least three events. First, the dragenter event, which is used to determine whether or not the drop target is to accept the drop.

Addresses #2576

This is my first code contribution and I'm much more comfortable in Ruby than JavaScript so please let me know if I've done this badly or misunderstood the JavaScript side of things!

@matt17r matt17r changed the title Add dragenter event and test to drag_to Add dragenter event and test to drag_to Oct 19, 2022
@boris-petrov
Copy link

Perhaps also add a test that verifies that the dragenter is dispatched before the dragover?

@matt17r
Copy link
Contributor Author

matt17r commented Oct 21, 2022

How about checking for both at the same time, @boris-petrov? Looks a bit ugly to me but since I need to check their order anyway, this finds the element in question then checks the dragover occurs next using preceding-sibling

@boris-petrov
Copy link

Isn't it possible to do something like expect(page).to have_text(/DragEnter.*DragOver/)?

@matt17r
Copy link
Contributor Author

matt17r commented Oct 21, 2022

That's much simpler! Events are listed in reverse chronological order...

image

It's not obvious reading the test and I couldn't think of a way to make it explicit in code so I added a comment. There's a similar comment on what's currently line 562

@matt17r
Copy link
Contributor Author

matt17r commented Oct 21, 2022

Whoops, now the test isn't passing. Bear with me 🙃

@matt17r
Copy link
Contributor Author

matt17r commented Oct 21, 2022

Ugh, I'm trying to rebase against master, squash it all into a single commit and then force push to my branch but I clearly don't know what I'm doing

Edit: Rebased and squashed to keep the history clean

@matt17r matt17r closed this by deleting the head repository Oct 28, 2022
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.

2 participants