TestHelpers.draggable = {};
+// todo: remove these hacks
+TestHelpers.draggable.unreliableOffset = $.ui.ie && ( !document.documentMode || document.documentMode < 8 ) ? 2 : 0;
+
TestHelpers.draggable.drag = function(handle, dx, dy) {
$(handle).simulate("drag", {
dx: dx || 0,
};
TestHelpers.draggable.border = function(el, side) {
- return parseInt(el.css('border-' + side + '-width'), 10);
+ return parseInt(el.css('border-' + side + '-width'), 10) || 0;
};
TestHelpers.draggable.margin = function(el, side) {
- return parseInt(el.css('margin-' + side), 10);
+ return parseInt(el.css('margin-' + side), 10) || 0;
};
(function($) {
clientY: before.top + offsetY
};
expected = {
- left: before.left + offsetX - cursorAtX + deltaX,
- top: before.top + offsetY - cursorAtY + deltaY
+ left: before.left + offsetX - cursorAtX + deltaX - TestHelpers.draggable.unreliableOffset,
+ top: before.top + offsetY - cursorAtY + deltaY - TestHelpers.draggable.unreliableOffset
};
el.simulate("mousedown", pos);
clientY: before.top + offsetY
};
expected = {
- left: before.left + offsetX - el.width() + cursorAtX + deltaX,
- top: before.top + offsetY - el.height() + cursorAtY + deltaY
+ left: before.left + offsetX - el.width() + cursorAtX + deltaX - TestHelpers.draggable.unreliableOffset,
+ top: before.top + offsetY - el.height() + cursorAtY + deltaY - TestHelpers.draggable.unreliableOffset
};
el.simulate("mousedown", pos);
clientY: before.top + offsetY
};
expected = {
- left: before.left + offsetX - cursorAtX + deltaX,
- top: before.top + offsetY - cursorAtY + deltaY
+ left: before.left + offsetX - cursorAtX + deltaX - TestHelpers.draggable.unreliableOffset,
+ top: before.top + offsetY - cursorAtY + deltaY - TestHelpers.draggable.unreliableOffset
};
el.simulate("mousedown", pos);
clientY: before.top + offsetY
};
expected = {
- left: before.left + offsetX - cursorAtX + deltaX,
- top: before.top + offsetY - cursorAtY + deltaY
+ left: before.left + offsetX - cursorAtX + deltaX - TestHelpers.draggable.unreliableOffset,
+ top: before.top + offsetY - cursorAtY + deltaY - TestHelpers.draggable.unreliableOffset
};
el.simulate("mousedown", pos);