I enabled dragging in production UI and it has been working in both Chrome and FF. However, the same thing does not work with Siesta test case. I inspected the Dom to make sure "draggable" attribute is true. However, when I manually drag the item using the mouse, no drag event happens. I am supposed to hit my "debugger" statement. Any idea why?
Ext.define('composition.Events', {
singleton: true,
/**
* Attaches a listener to the specified element.
* @param element: the DOM element
* @param eventName: the name of the event
* @param listener: the event callback
*/
addListener: function(element, eventName, listener) {
if (element.addEventListener) {
element.addEventListener(eventName, listener, false);
} else {
// Internet Explorer
// note: event names must be prepended with 'on'
element.attachEvent('on' + eventName, listener);
}
},
/**
* Enables drag and drop event chain on an element.
* @param element: the DOM element
* @param dragStartHandler: the callback
*/
makeDraggable: function(element, dragStartHandler) {
element.setAttribute('draggable', true);
composition.Events.addListener(element, 'dragstart', dragStartHandler);
}
});
Attachments
BlueprintCanvasSiestaTestCase.png (100.18 KiB) Viewed 5144 times
I was trying to drag Apache or Iaas Machine. You can see a drag image moving with the mouse cursor. However, if you do the same thing in Siesta test case, you don't see any drag image.
I'd recommend to use the Sencha drag drop implementation. The native one you use is not x-browser, and native DnD is not a very good solution. Please see:
After spending about a day and a half in testing I am forced to conclude that the HTML5 drag and drop module is not just a disaster, it’s a fucking disaster.