ember-drag-drop icon indicating copy to clipboard operation
ember-drag-drop copied to clipboard

Adding `types` properties into mocked DataTransfer

Open GabrielCousin opened this issue 4 years ago • 1 comments

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 avatar Sep 27 '21 20:09 GabrielCousin

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

GabrielCousin avatar Oct 24 '22 10:10 GabrielCousin