]> source.dussan.org Git - jquery-ui.git/commitdiff
Dev: fix IE fails in draggable and selectable - Fixed #8770 Dev: Remove globals and... 809/head
authorMike Sherov <mike.sherov@gmail.com>
Sun, 4 Nov 2012 14:31:56 +0000 (09:31 -0500)
committerMike Sherov <mike.sherov@gmail.com>
Sun, 4 Nov 2012 14:31:56 +0000 (09:31 -0500)
tests/unit/draggable/draggable_core.js
tests/unit/selectable/selectable_options.js
tests/unit/selectable/selectable_test_helpers.js

index 0e9d04be1ff97f400185c96de2881b0fc7c89df3..39151d5f7f00190b26e077dd3f60f2bda96c1d22 100644 (file)
@@ -24,8 +24,8 @@ test("element types", function() {
                offsetBefore = el.offset();
                TestHelpers.draggable.drag(el, 50, 50);
                offsetAfter = el.offset();
-               //there are some rounding errors in FF and Chrome, so we can't say equal, we have to settle for close enough
-               ok(offsetAfter.left - offsetBefore.left - 50 < 1 && offsetAfter.top - offsetBefore.top - 50 < 1, 'dragged[50, 50] ' + "&lt;" + typeName + "&gt;");
+               // there are some rounding errors in FF, Chrome, and IE9, so we can't say equal, we have to settle for close enough
+               ok( offsetAfter.left - offsetBefore.left - 50 <= 1 && offsetAfter.top - offsetBefore.top - 50 <= 1, "dragged[50, 50] " + "&lt;" + typeName + "&gt;" );
                el.draggable("destroy");
                el.remove();
        });
index 2b7fc16487fff7c31925e447161ff323ff569cba..50e047427af9a629b4211f72f73eb9ea8ff3823a 100644 (file)
@@ -26,7 +26,7 @@ test("autoRefresh", function() {
        TestHelpers.selectable.drag(el, 1000, 1000);
        equal(actual, 0);
        sel.show();
-       TestHelpers.selectable.drag(el, 1000, 1000);
+       TestHelpers.selectable.drag( sel[ 0 ], 1000, 1000 );
        equal(actual, sel.length);
        el.selectable("destroy");
        sel.show();
index c707ab622daae1d2ebd3a9a9b941c2cb65572491..6f87efbb38cc04e7108398a830d08c21367372d4 100644 (file)
@@ -1,12 +1,8 @@
 TestHelpers.selectable = {
-       drag: function(el, dx, dy) {
-               var off = el.offset(),
-                       pos = { clientX: off.left, clientY: off.top };
-               el.simulate("mousedown", pos);
-               $(document).simulate("mousemove", pos);
-               pos.clientX += dx;
-               pos.clientY += dy;
-               $(document).simulate("mousemove", pos);
-               $(document).simulate("mouseup", pos);
+       drag: function( el, dx, dy ) {
+               $( el ).simulate( "drag", {
+                       dx: dx || 0,
+                       dy: dy || 0
+               });
        }
 };
\ No newline at end of file