5

I have local html file with javascript code.

I should cover drag & drop by tests.

It uses only IE.

In javascript code event "drop" is caught and content of dataTransfer (e.dataTransfer.getData("Text")) is analysed.

In test I simulate event with next code:

event = document.createEventObject();

Here event which contains dataTransfer == null is created.

Write is impossible, because property is read only.

target.fireEvent("ondrop", event);

Event is fired in javascript code, but dataTransfer is null.

I should put some test element in dataTransfer.

How can I resolve this problem?

Alexey
  • 61
  • 3

1 Answers1

0

You could try using the CustomEvent interface, I'm not sure if it works in IE though.

var event = new CustomEvent('build', { 'detail': elem.dataset.time });

https://developer.mozilla.org/en-US/docs/Web/API/document.createEvent#Adding_custom_data_.E2.80.93_CustomEvent