mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Draggable Tests: Remove Future Unsupported APIs
This commit is contained in:
parent
e4a786e1a4
commit
4c7b57859f
@ -53,17 +53,23 @@ test("stopping the start callback", function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("stopping the drag callback", function() {
|
test( "stopping the drag callback", function() {
|
||||||
|
expect( 2 );
|
||||||
expect(3);
|
|
||||||
|
|
||||||
var start = 0,
|
var start = 0,
|
||||||
stop = 0,
|
stop = 0,
|
||||||
dragc = 0,
|
dragc = 0,
|
||||||
el = $("#draggable2").draggable({
|
el = $("#draggable2").draggable({
|
||||||
start: function() { start++;},
|
start: function() {
|
||||||
drag: function() { dragc++; return false; },
|
start++;
|
||||||
stop: function() { stop++; }
|
},
|
||||||
|
drag: function() {
|
||||||
|
dragc++;
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
stop: function() {
|
||||||
|
stop++;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
el.simulate( "drag", {
|
el.simulate( "drag", {
|
||||||
@ -71,10 +77,8 @@ test("stopping the drag callback", function() {
|
|||||||
dy: 10
|
dy: 10
|
||||||
});
|
});
|
||||||
|
|
||||||
equal(start, 1, "start callback should happen exactly once");
|
equal( start, 1, "start callback should happen exactly once" );
|
||||||
equal(dragc, 1, "drag callback should happen exactly once");
|
equal( stop, 1, "stop callback should happen, as we need to actively stop the drag" );
|
||||||
equal(stop, 1, "stop callback should happen, as we need to actively stop the drag");
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("stopping the stop callback", function() {
|
test("stopping the stop callback", function() {
|
||||||
|
@ -114,7 +114,9 @@ test("{ cancel: 'span' }", function() {
|
|||||||
TestHelpers.draggable.testDrag(el, "#draggable2 span", 50, 50, 0, 0);
|
TestHelpers.draggable.testDrag(el, "#draggable2 span", 50, 50, 0, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("{ cancel: ? }, unexpected", function() {
|
test( "{ cancel: ? }, unexpected", function() {
|
||||||
|
expect( 6 );
|
||||||
|
|
||||||
var el,
|
var el,
|
||||||
unexpected = {
|
unexpected = {
|
||||||
"true": true,
|
"true": true,
|
||||||
@ -122,17 +124,12 @@ test("{ cancel: ? }, unexpected", function() {
|
|||||||
"{}": {},
|
"{}": {},
|
||||||
"[]": [],
|
"[]": [],
|
||||||
"null": null,
|
"null": null,
|
||||||
"undefined": undefined,
|
"undefined": undefined
|
||||||
"function() {return '';}": function() {return "";},
|
|
||||||
"function() {return true;}": function() {return true;},
|
|
||||||
"function() {return false;}": function() {return false;}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
expect( 9 );
|
$.each( unexpected, function( key, val ) {
|
||||||
|
|
||||||
$.each(unexpected, function(key, val) {
|
|
||||||
el = $("#draggable2").draggable({ cancel: val });
|
el = $("#draggable2").draggable({ cancel: val });
|
||||||
TestHelpers.draggable.shouldMove(el, "cancel: " + key);
|
TestHelpers.draggable.shouldMove( el, "cancel: " + key );
|
||||||
el.draggable("destroy");
|
el.draggable("destroy");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -311,18 +308,6 @@ test( "cursorAt", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("{ distance: 10 }", function() {
|
|
||||||
expect( 3 );
|
|
||||||
|
|
||||||
var el = $("#draggable2").draggable({ distance: 10 });
|
|
||||||
TestHelpers.draggable.testDrag(el, el, -9, -9, 0, 0, "distance not met");
|
|
||||||
|
|
||||||
TestHelpers.draggable.testDrag(el, el, -10, -10, -10, -10, "distance met");
|
|
||||||
|
|
||||||
TestHelpers.draggable.testDrag(el, el, 9, 9, 0, 0, "distance not met");
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
test("{ grid: [50, 50] }, relative", function() {
|
test("{ grid: [50, 50] }, relative", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user