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 drag and drop support #1139

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 0 additions & 91 deletions addon-test-support/@ember/test-helpers/dom/drag-move.ts

This file was deleted.

38 changes: 21 additions & 17 deletions addon/addon-test-support/@ember/test-helpers/dom/drag-move.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { settled } from '..';
import { registerHook, runHooks } from '../-internal/helper-hooks';
import { registerHook, runHooks } from '../helper-hooks';
import getElement from './-get-element';
import { log } from './-logging';
import Target from './-target';
Expand Down Expand Up @@ -48,28 +48,32 @@ export default function dragMove(
.then(() =>
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.

fireEvent(dragEl, 'dragstart', {
dataTransfer: {
setData(someKey: string, value: string) {
context[someKey] = value;
},
},
});

fireEvent(targetEl, 'dragenter');

fireEvent(targetEl, 'dragover');

fireEvent(targetEl, 'drop', {
dataTransfer: {
getData(someKey: string) {
return context[someKey];
},
},
});

return settled();
})
.then(() => {
fireEvent(targetEl, 'dragenter');
})
.then(() => {
fireEvent(targetEl, 'dragover');
})
.then(() => {
fireEvent(targetEl, 'drop', {
dataTransfer: {
getData(someKey: string) {
return context[someKey];
},
},
});
})
.then(() => {
return settled();
});
})
.then(() =>
runHooks('dragMove', 'end', draggableStartElement, dropTargetElement)
Expand Down