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

Adding types properties into mocked DataTransfer #191

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GabrielCousin
Copy link

Hey there!

We've been using this addon quite intensively lately, thanks for the hard work!
In order to be able to check the validity of the drag event, we ended up doing this:

import DraggableObjectTarget from 'ember-drag-drop/components/draggable-object-target';

export default class CustomDraggableObjectTarget extends DraggableObjectTarget {
  validateDragEvent(event) {
    return event.dataTransfer.types.length === 1 && event.dataTransfer.types.includes('text/plain');
  }
}

But the problem introduced is that we can no longer use the drag test-helper.
This PR aims at adding a types property in the mocked DataTransfer :)

Let me know if you see anything I may rework!

Thanks!

@GabrielCousin
Copy link
Author

Hi @mharris717!
Any chance you can have a look at this or discuss anything that may look wrong to you?
Thanks a lot 🙌

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.

1 participant