mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Dev: remove unnecessary simulated drag delegation in test suite
This commit is contained in:
parent
5dee8dee30
commit
9f76446775
@ -3,10 +3,9 @@ TestHelpers.dialog = {
|
||||
var d = el.dialog('widget');
|
||||
//this mouseover is to work around a limitation in resizable
|
||||
//TODO: fix resizable so handle doesn't require mouseover in order to be used
|
||||
$(handle, d).simulate("mouseover");
|
||||
$(handle, d).simulate("drag", {
|
||||
dx: dx || 0,
|
||||
dy: dy || 0
|
||||
$( handle, d ).simulate("mouseover").simulate( "drag", {
|
||||
dx: dx,
|
||||
dy: dy
|
||||
});
|
||||
},
|
||||
testDrag: function(el, dx, dy, expectedDX, expectedDY, msg) {
|
||||
|
@ -22,7 +22,10 @@ test("element types", function() {
|
||||
(typeName === 'table' && el.append("<tr><td>content</td></tr>"));
|
||||
el.draggable({ cancel: '' });
|
||||
offsetBefore = el.offset();
|
||||
TestHelpers.draggable.drag(el, 50, 50);
|
||||
el.simulate( "drag", {
|
||||
dx: 50,
|
||||
dy: 50
|
||||
});
|
||||
offsetAfter = el.offset();
|
||||
// there are some rounding errors in FF, Chrome, and IE9, so we can't say equal, we have to settle for close enough
|
||||
closeEnough(offsetBefore.left, offsetAfter.left - 50, 1, "dragged[50, 50] " + "<" + typeName + ">");
|
||||
@ -55,21 +58,15 @@ test("resizable handle with complex markup (#8756 / #8757)", function() {
|
||||
.append($('<div>'))
|
||||
);
|
||||
|
||||
var handle = '.ui-resizable-w div',
|
||||
target = $('#draggable1').draggable().resizable({ handles: 'all' }),
|
||||
drag = function(el, dx) {
|
||||
$(el)
|
||||
.simulate("mouseover")
|
||||
.simulate("drag", {
|
||||
dx: dx || 0,
|
||||
speed: 'sync'
|
||||
});
|
||||
};
|
||||
var handle = $('.ui-resizable-w div'),
|
||||
target = $('#draggable1').draggable().resizable({ handles: 'all' });
|
||||
|
||||
drag(handle, -50);
|
||||
// todo: fix resizable so it doesn't require a mouseover
|
||||
handle.simulate("mouseover").simulate( "drag", { dx: -50 } );
|
||||
equal( target.width(), 250, "compare width" );
|
||||
|
||||
drag(handle, 50);
|
||||
// todo: fix resizable so it doesn't require a mouseover
|
||||
handle.simulate("mouseover").simulate( "drag", { dx: 50 } );
|
||||
equal( target.width(), 200, "compare width" );
|
||||
});
|
||||
|
||||
|
@ -18,7 +18,10 @@ test("callbacks occurrence count", function() {
|
||||
stop: function() { stop++; }
|
||||
});
|
||||
|
||||
TestHelpers.draggable.drag(el, 10, 10);
|
||||
el.simulate( "drag", {
|
||||
dx: 10,
|
||||
dy: 10
|
||||
});
|
||||
|
||||
equal(start, 1, "start callback should happen exactly once");
|
||||
equal(dragc, 3, "drag callback should happen exactly once per mousemove");
|
||||
@ -39,7 +42,10 @@ test("stopping the start callback", function() {
|
||||
stop: function() { stop++; }
|
||||
});
|
||||
|
||||
TestHelpers.draggable.drag(el, 10, 10);
|
||||
el.simulate( "drag", {
|
||||
dx: 10,
|
||||
dy: 10
|
||||
});
|
||||
|
||||
equal(start, 1, "start callback should happen exactly once");
|
||||
equal(dragc, 0, "drag callback should not happen at all");
|
||||
@ -60,7 +66,10 @@ test("stopping the drag callback", function() {
|
||||
stop: function() { stop++; }
|
||||
});
|
||||
|
||||
TestHelpers.draggable.drag(el, 10, 10);
|
||||
el.simulate( "drag", {
|
||||
dx: 10,
|
||||
dy: 10
|
||||
});
|
||||
|
||||
equal(start, 1, "start callback should happen exactly once");
|
||||
equal(dragc, 1, "drag callback should happen exactly once");
|
||||
@ -77,7 +86,10 @@ test("stopping the stop callback", function() {
|
||||
stop: function() { return false; }
|
||||
});
|
||||
|
||||
TestHelpers.draggable.drag(el, 10, 10);
|
||||
el.simulate( "drag", {
|
||||
dx: 10,
|
||||
dy: 10
|
||||
});
|
||||
|
||||
ok($("#draggable2").data('ui-draggable').helper, "the clone should not be deleted if the stop callback is stopped");
|
||||
|
||||
|
@ -162,7 +162,11 @@ test("{ containment: 'parent' }, relative", function() {
|
||||
left: po.left + TestHelpers.draggable.border(p, 'left') + TestHelpers.draggable.margin(el, 'left'),
|
||||
top: po.top + TestHelpers.draggable.border(p, 'top') + TestHelpers.draggable.margin(el, 'top')
|
||||
};
|
||||
TestHelpers.draggable.drag(el, -100, -100);
|
||||
|
||||
el.simulate( "drag", {
|
||||
dx: -100,
|
||||
dy: -100
|
||||
});
|
||||
offsetAfter = el.offset();
|
||||
deepEqual(offsetAfter, expected, 'compare offset to parent');
|
||||
});
|
||||
@ -178,7 +182,11 @@ test("{ containment: 'parent' }, absolute", function() {
|
||||
left: po.left + TestHelpers.draggable.border(p, 'left') + TestHelpers.draggable.margin(el, 'left'),
|
||||
top: po.top + TestHelpers.draggable.border(p, 'top') + TestHelpers.draggable.margin(el, 'top')
|
||||
};
|
||||
TestHelpers.draggable.drag(el, -100, -100);
|
||||
|
||||
el.simulate( "drag", {
|
||||
dx: -100,
|
||||
dy: -100
|
||||
});
|
||||
offsetAfter = el.offset();
|
||||
deepEqual(offsetAfter, expected, 'compare offset to parent');
|
||||
});
|
||||
@ -214,9 +222,9 @@ test("{ cursor: 'auto' }, default", function() {
|
||||
|
||||
expect(2);
|
||||
|
||||
var expected = "auto", actual, before, after;
|
||||
|
||||
$("#draggable2").draggable({
|
||||
var actual, before, after,
|
||||
expected = "auto",
|
||||
el = $("#draggable2").draggable({
|
||||
cursor: expected,
|
||||
start: function() {
|
||||
actual = getCursor();
|
||||
@ -224,7 +232,10 @@ test("{ cursor: 'auto' }, default", function() {
|
||||
});
|
||||
|
||||
before = getCursor();
|
||||
TestHelpers.draggable.drag("#draggable2", -1, -1);
|
||||
el.simulate( "drag", {
|
||||
dx: -1,
|
||||
dy: -1
|
||||
});
|
||||
after = getCursor();
|
||||
|
||||
equal(actual, expected, "start callback: cursor '" + expected + "'");
|
||||
@ -238,9 +249,9 @@ test("{ cursor: 'move' }", function() {
|
||||
|
||||
expect(2);
|
||||
|
||||
var expected = "move", actual, before, after;
|
||||
|
||||
$("#draggable2").draggable({
|
||||
var actual, before, after,
|
||||
expected = "move",
|
||||
el = $("#draggable2").draggable({
|
||||
cursor: expected,
|
||||
start: function() {
|
||||
actual = getCursor();
|
||||
@ -248,7 +259,10 @@ test("{ cursor: 'move' }", function() {
|
||||
});
|
||||
|
||||
before = getCursor();
|
||||
TestHelpers.draggable.drag("#draggable2", -1, -1);
|
||||
el.simulate( "drag", {
|
||||
dx: -1,
|
||||
dy: -1
|
||||
});
|
||||
after = getCursor();
|
||||
|
||||
equal(actual, expected, "start callback: cursor '" + expected + "'");
|
||||
@ -648,7 +662,10 @@ test("{ helper: 'clone' }, absolute", function() {
|
||||
helperOffset = ui.helper.offset();
|
||||
} });
|
||||
|
||||
TestHelpers.draggable.drag(el, 1, 1);
|
||||
el.simulate( "drag", {
|
||||
dx: 1,
|
||||
dy: 1
|
||||
});
|
||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
||||
|
||||
});
|
||||
@ -666,17 +683,26 @@ test("{ helper: 'clone' }, absolute with scroll offset on parent", function() {
|
||||
|
||||
$("#main").css('position', 'relative');
|
||||
origOffset = $("#draggable1").offset();
|
||||
TestHelpers.draggable.drag(el, 1, 1);
|
||||
el.simulate( "drag", {
|
||||
dx: 1,
|
||||
dy: 1
|
||||
});
|
||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
||||
|
||||
$("#main").css('position', 'static');
|
||||
origOffset = $("#draggable1").offset();
|
||||
TestHelpers.draggable.drag(el, 1, 1);
|
||||
el.simulate( "drag", {
|
||||
dx: 1,
|
||||
dy: 1
|
||||
});
|
||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
||||
|
||||
$("#main").css('position', 'absolute');
|
||||
origOffset = $("#draggable1").offset();
|
||||
TestHelpers.draggable.drag(el, 1, 1);
|
||||
el.simulate( "drag", {
|
||||
dx: 1,
|
||||
dy: 1
|
||||
});
|
||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
||||
|
||||
TestHelpers.draggable.restoreScroll();
|
||||
@ -696,17 +722,26 @@ test("{ helper: 'clone' }, absolute with scroll offset on root", function() {
|
||||
|
||||
$("#main").css('position', 'relative');
|
||||
origOffset = $("#draggable1").offset();
|
||||
TestHelpers.draggable.drag(el, 1, 1);
|
||||
el.simulate( "drag", {
|
||||
dx: 1,
|
||||
dy: 1
|
||||
});
|
||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
||||
|
||||
$("#main").css('position', 'static');
|
||||
origOffset = $("#draggable1").offset();
|
||||
TestHelpers.draggable.drag(el, 1, 1);
|
||||
el.simulate( "drag", {
|
||||
dx: 1,
|
||||
dy: 1
|
||||
});
|
||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
||||
|
||||
$("#main").css('position', 'absolute');
|
||||
origOffset = $("#draggable1").offset();
|
||||
TestHelpers.draggable.drag(el, 1, 1);
|
||||
el.simulate( "drag", {
|
||||
dx: 1,
|
||||
dy: 1
|
||||
});
|
||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
||||
|
||||
TestHelpers.draggable.restoreScroll('root');
|
||||
@ -728,17 +763,26 @@ test("{ helper: 'clone' }, absolute with scroll offset on root and parent", func
|
||||
|
||||
$("#main").css('position', 'relative');
|
||||
origOffset = $("#draggable1").offset();
|
||||
TestHelpers.draggable.drag(el, 1, 1);
|
||||
el.simulate( "drag", {
|
||||
dx: 1,
|
||||
dy: 1
|
||||
});
|
||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
||||
|
||||
$("#main").css('position', 'static');
|
||||
origOffset = $("#draggable1").offset();
|
||||
TestHelpers.draggable.drag(el, 1, 1);
|
||||
el.simulate( "drag", {
|
||||
dx: 1,
|
||||
dy: 1
|
||||
});
|
||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
||||
|
||||
$("#main").css('position', 'absolute');
|
||||
origOffset = $("#draggable1").offset();
|
||||
TestHelpers.draggable.drag(el, 1, 1);
|
||||
el.simulate( "drag", {
|
||||
dx: 1,
|
||||
dy: 1
|
||||
});
|
||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[1, 1] ');
|
||||
|
||||
TestHelpers.draggable.restoreScroll('root');
|
||||
@ -750,16 +794,18 @@ test("{ opacity: 0.5 }", function() {
|
||||
|
||||
expect(1);
|
||||
|
||||
var opacity = null;
|
||||
|
||||
$("#draggable2").draggable({
|
||||
var opacity = null,
|
||||
el = $("#draggable2").draggable({
|
||||
opacity: 0.5,
|
||||
start: function() {
|
||||
opacity = $(this).css("opacity");
|
||||
}
|
||||
});
|
||||
|
||||
TestHelpers.draggable.drag("#draggable2", -1, -1);
|
||||
el.simulate( "drag", {
|
||||
dx: -1,
|
||||
dy: -1
|
||||
});
|
||||
|
||||
equal(opacity, 0.5, "start callback: opacity is");
|
||||
|
||||
@ -770,16 +816,18 @@ test("{ zIndex: 10 }", function() {
|
||||
expect(1);
|
||||
|
||||
var actual,
|
||||
expected = 10;
|
||||
|
||||
$("#draggable2").draggable({
|
||||
expected = 10,
|
||||
el = $("#draggable2").draggable({
|
||||
zIndex: expected,
|
||||
start: function() {
|
||||
actual = $(this).css("zIndex");
|
||||
}
|
||||
});
|
||||
|
||||
TestHelpers.draggable.drag("#draggable2", -1, -1);
|
||||
el.simulate( "drag", {
|
||||
dx: -1,
|
||||
dy: -1
|
||||
});
|
||||
|
||||
equal(actual, expected, "start callback: zIndex is");
|
||||
|
||||
|
@ -1,17 +1,14 @@
|
||||
TestHelpers.draggable = {
|
||||
// todo: remove the unreliable offset hacks
|
||||
unreliableOffset: $.ui.ie && ( !document.documentMode || document.documentMode < 8 ) ? 2 : 0,
|
||||
drag: function(handle, dx, dy) {
|
||||
$(handle).simulate("drag", {
|
||||
dx: dx || 0,
|
||||
dy: dy || 0
|
||||
});
|
||||
},
|
||||
testDrag: function(el, handle, dx, dy, expectedDX, expectedDY, msg) {
|
||||
var offsetAfter, actual, expected,
|
||||
offsetBefore = el.offset();
|
||||
|
||||
TestHelpers.draggable.drag(handle, dx, dy);
|
||||
$( handle ).simulate( "drag", {
|
||||
dx: dx,
|
||||
dy: dy
|
||||
});
|
||||
offsetAfter = el.offset();
|
||||
|
||||
actual = { left: offsetAfter.left, top: offsetAfter.top },
|
||||
|
@ -1,15 +1,10 @@
|
||||
TestHelpers.resizable = {
|
||||
drag: function(el, dx, dy, complete) {
|
||||
|
||||
// speed = sync -> Drag syncrhonously.
|
||||
// speed = fast|slow -> Drag asyncrhonously - animated.
|
||||
|
||||
drag: function( el, dx, dy ) {
|
||||
// this mouseover is to work around a limitation in resizable
|
||||
// TODO: fix resizable so handle doesn't require mouseover in order to be used
|
||||
$(el).simulate("mouseover");
|
||||
|
||||
return $(el).simulate("drag", {
|
||||
dx: dx||0, dy: dy||0, speed: 'sync', complete: complete
|
||||
$( el ).simulate("mouseover").simulate( "drag", {
|
||||
dx: dx,
|
||||
dy: dy
|
||||
});
|
||||
}
|
||||
};
|
@ -14,7 +14,10 @@ test("start", function() {
|
||||
equal( this, el[0], "context of callback" );
|
||||
}
|
||||
});
|
||||
el.simulate("drag", 20, 20);
|
||||
el.simulate( "drag", {
|
||||
dx: 20,
|
||||
dy: 20
|
||||
});
|
||||
});
|
||||
|
||||
test( "stop", function() {
|
||||
@ -26,7 +29,10 @@ test("stop", function() {
|
||||
equal( this, el[0], "context of callback" );
|
||||
}
|
||||
});
|
||||
el.simulate("drag", 20, 20);
|
||||
el.simulate( "drag", {
|
||||
dx: 20,
|
||||
dy: 20
|
||||
});
|
||||
});
|
||||
|
||||
})( jQuery );
|
||||
|
@ -53,10 +53,16 @@ test("enable", function() {
|
||||
disabled: true,
|
||||
start: function() { fired = true; }
|
||||
});
|
||||
el.simulate("drag", 20, 20);
|
||||
el.simulate( "drag", {
|
||||
dx: 20,
|
||||
dy: 20
|
||||
});
|
||||
equal(fired, false, "start fired");
|
||||
el.selectable("enable");
|
||||
el.simulate("drag", 20, 20);
|
||||
el.simulate( "drag", {
|
||||
dx: 20,
|
||||
dy: 20
|
||||
});
|
||||
equal(fired, true, "start fired");
|
||||
el.selectable("destroy");
|
||||
|
||||
@ -75,11 +81,18 @@ test("disable", function() {
|
||||
disabled: false,
|
||||
start: function() { fired = true; }
|
||||
});
|
||||
el.simulate("drag", 20, 20);
|
||||
el.simulate( "drag", {
|
||||
dx: 20,
|
||||
dy: 20
|
||||
});
|
||||
equal(fired, true, "start fired");
|
||||
el.selectable("disable");
|
||||
fired = false;
|
||||
el.simulate("drag", 20, 20);
|
||||
|
||||
el.simulate( "drag", {
|
||||
dx: 20,
|
||||
dy: 20
|
||||
});
|
||||
equal(fired, false, "start fired");
|
||||
el.selectable("destroy");
|
||||
|
||||
|
@ -15,7 +15,10 @@ test("autoRefresh", function() {
|
||||
|
||||
el = $("#selectable1").selectable({ autoRefresh: false, selected: selected });
|
||||
sel.hide();
|
||||
TestHelpers.selectable.drag(el, 1000, 1000);
|
||||
el.simulate( "drag", {
|
||||
dx: 1000,
|
||||
dy: 1000
|
||||
});
|
||||
equal(actual, sel.length);
|
||||
el.selectable("destroy");
|
||||
|
||||
@ -23,11 +26,19 @@ test("autoRefresh", function() {
|
||||
sel.show();
|
||||
el = $("#selectable1").selectable({ autoRefresh: true, selected: selected });
|
||||
sel.hide();
|
||||
TestHelpers.selectable.drag(el, 1000, 1000);
|
||||
el.simulate( "drag", {
|
||||
dx: 1000,
|
||||
dy: 1000
|
||||
});
|
||||
equal(actual, 0);
|
||||
|
||||
sel.show();
|
||||
TestHelpers.selectable.drag( sel[ 0 ], 1000, 1000 );
|
||||
$( sel[ 0 ] ).simulate( "drag", {
|
||||
dx: 1000,
|
||||
dy: 1000
|
||||
});
|
||||
equal(actual, sel.length);
|
||||
|
||||
el.selectable("destroy");
|
||||
sel.show();
|
||||
});
|
||||
@ -42,7 +53,10 @@ test("filter", function() {
|
||||
|
||||
|
||||
el = $("#selectable1").selectable({ filter: '.special', selected: selected });
|
||||
TestHelpers.selectable.drag(el, 1000, 1000);
|
||||
el.simulate( "drag", {
|
||||
dx: 1000,
|
||||
dy: 1000
|
||||
});
|
||||
ok(sel.length !== 1, "this test assumes more than 1 selectee");
|
||||
equal(actual, 1);
|
||||
el.selectable("destroy");
|
||||
|
@ -1,8 +0,0 @@
|
||||
TestHelpers.selectable = {
|
||||
drag: function( el, dx, dy ) {
|
||||
$( el ).simulate( "drag", {
|
||||
dx: dx || 0,
|
||||
dy: dy || 0
|
||||
});
|
||||
}
|
||||
};
|
@ -9,9 +9,13 @@ test("start", function() {
|
||||
expect( 7 );
|
||||
|
||||
var hash;
|
||||
$("#sortable")
|
||||
.sortable({ start: function(e, ui) { hash = ui; } })
|
||||
.find('li:eq(0)').simulate("drag", { dx: 0, dy: 10 });
|
||||
$("#sortable").sortable({
|
||||
start: function( e, ui ) {
|
||||
hash = ui;
|
||||
}
|
||||
}).find("li:eq(0)").simulate( "drag", {
|
||||
dy: 10
|
||||
});
|
||||
|
||||
ok(hash, 'start event triggered');
|
||||
ok(hash.helper, 'UI hash includes: helper');
|
||||
@ -30,9 +34,13 @@ test("sort", function() {
|
||||
expect( 7 );
|
||||
|
||||
var hash;
|
||||
$("#sortable")
|
||||
.sortable({ sort: function(e, ui) { hash = ui; } })
|
||||
.find('li:eq(0)').simulate("drag", { dx: 0, dy: 10 });
|
||||
$("#sortable").sortable({
|
||||
sort: function( e, ui ) {
|
||||
hash = ui;
|
||||
}
|
||||
}).find("li:eq(0)").simulate( "drag", {
|
||||
dy: 10
|
||||
});
|
||||
|
||||
ok(hash, 'sort event triggered');
|
||||
ok(hash.helper, 'UI hash includes: helper');
|
||||
@ -48,15 +56,24 @@ test("change", function() {
|
||||
expect( 8 );
|
||||
|
||||
var hash;
|
||||
$("#sortable")
|
||||
.sortable({ change: function(e, ui) { hash = ui; } })
|
||||
.find('li:eq(0)').simulate("drag", { dx: 1, dy: 1 });
|
||||
$("#sortable").sortable({
|
||||
change: function( e, ui ) {
|
||||
hash = ui;
|
||||
}
|
||||
}).find("li:eq(0)").simulate( "drag", {
|
||||
dx: 1,
|
||||
dy: 1
|
||||
});
|
||||
|
||||
ok(!hash, '1px drag, change event should not be triggered');
|
||||
|
||||
$("#sortable")
|
||||
.sortable({ change: function(e, ui) { hash = ui; } })
|
||||
.find('li:eq(0)').simulate("drag", { dx: 0, dy: 22 });
|
||||
$("#sortable").sortable({
|
||||
change: function( e, ui ) {
|
||||
hash = ui;
|
||||
}
|
||||
}).find("li:eq(0)").simulate( "drag", {
|
||||
dy: 22
|
||||
});
|
||||
|
||||
ok(hash, 'change event triggered');
|
||||
ok(hash.helper, 'UI hash includes: helper');
|
||||
@ -72,9 +89,13 @@ test("beforeStop", function() {
|
||||
expect( 7 );
|
||||
|
||||
var hash;
|
||||
$("#sortable")
|
||||
.sortable({ beforeStop: function(e, ui) { hash = ui; } })
|
||||
.find('li:eq(0)').simulate("drag", { dx: 0, dy: 20 });
|
||||
$("#sortable").sortable({
|
||||
beforeStop: function( e, ui ) {
|
||||
hash = ui;
|
||||
}
|
||||
}).find("li:eq(0)").simulate( "drag", {
|
||||
dy: 20
|
||||
});
|
||||
|
||||
ok(hash, 'beforeStop event triggered');
|
||||
ok(hash.helper, 'UI hash includes: helper');
|
||||
@ -90,9 +111,13 @@ test("stop", function() {
|
||||
expect( 7 );
|
||||
|
||||
var hash;
|
||||
$("#sortable")
|
||||
.sortable({ stop: function(e, ui) { hash = ui; } })
|
||||
.find('li:eq(0)').simulate("drag", { dx: 0, dy: 20 });
|
||||
$("#sortable").sortable({
|
||||
stop: function( e, ui ) {
|
||||
hash = ui;
|
||||
}
|
||||
}).find("li:eq(0)").simulate( "drag", {
|
||||
dy: 20
|
||||
});
|
||||
|
||||
ok(hash, 'stop event triggered');
|
||||
ok(!hash.helper, 'UI should not include: helper');
|
||||
@ -108,15 +133,24 @@ test("update", function() {
|
||||
expect( 8 );
|
||||
|
||||
var hash;
|
||||
$("#sortable")
|
||||
.sortable({ update: function(e, ui) { hash = ui; } })
|
||||
.find('li:eq(0)').simulate("drag", { dx: 1, dy: 1 });
|
||||
$("#sortable").sortable({
|
||||
update: function( e, ui ) {
|
||||
hash = ui;
|
||||
}
|
||||
}).find("li:eq(0)").simulate( "drag", {
|
||||
dx: 1,
|
||||
dy: 1
|
||||
});
|
||||
|
||||
ok(!hash, '1px drag, update event should not be triggered');
|
||||
|
||||
$("#sortable")
|
||||
.sortable({ update: function(e, ui) { hash = ui; } })
|
||||
.find('li:eq(0)').simulate("drag", { dx: 0, dy: 22 });
|
||||
$("#sortable").sortable({
|
||||
update: function( e, ui ) {
|
||||
hash = ui;
|
||||
}
|
||||
}).find("li:eq(0)").simulate( "drag", {
|
||||
dy: 22
|
||||
});
|
||||
|
||||
ok(hash, 'update event triggered');
|
||||
ok(!hash.helper, 'UI hash should not include: helper');
|
||||
|
@ -1,8 +1,8 @@
|
||||
TestHelpers.sortable = {
|
||||
sort: function( handle, dx, dy, index, msg ) {
|
||||
$( handle ).simulate( "drag", {
|
||||
dx: dx || 0,
|
||||
dy: dy || 0
|
||||
dx: dx,
|
||||
dy: dy
|
||||
});
|
||||
equal( $( handle ).parent().children().index( handle ), index, msg );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user