Draggable Tests: Remove Future Unsupported APIs

This commit is contained in:
Mike Sherov 2013-01-12 00:33:45 -05:00
parent e4a786e1a4
commit 4c7b57859f
2 changed files with 20 additions and 31 deletions

View File

@ -53,17 +53,23 @@ test("stopping the start callback", function() {
});
test("stopping the drag callback", function() {
expect(3);
test( "stopping the drag callback", function() {
expect( 2 );
var start = 0,
stop = 0,
dragc = 0,
el = $("#draggable2").draggable({
start: function() { start++;},
drag: function() { dragc++; return false; },
stop: function() { stop++; }
start: function() {
start++;
},
drag: function() {
dragc++;
return false;
},
stop: function() {
stop++;
}
});
el.simulate( "drag", {
@ -71,10 +77,8 @@ test("stopping the drag callback", function() {
dy: 10
});
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( start, 1, "start callback should happen exactly once" );
equal( stop, 1, "stop callback should happen, as we need to actively stop the drag" );
});
test("stopping the stop callback", function() {

View File

@ -114,7 +114,9 @@ test("{ cancel: 'span' }", function() {
TestHelpers.draggable.testDrag(el, "#draggable2 span", 50, 50, 0, 0);
});
test("{ cancel: ? }, unexpected", function() {
test( "{ cancel: ? }, unexpected", function() {
expect( 6 );
var el,
unexpected = {
"true": true,
@ -122,17 +124,12 @@ test("{ cancel: ? }, unexpected", function() {
"{}": {},
"[]": [],
"null": null,
"undefined": undefined,
"function() {return '';}": function() {return "";},
"function() {return true;}": function() {return true;},
"function() {return false;}": function() {return false;}
"undefined": undefined
};
expect( 9 );
$.each(unexpected, function(key, val) {
$.each( unexpected, function( key, val ) {
el = $("#draggable2").draggable({ cancel: val });
TestHelpers.draggable.shouldMove(el, "cancel: " + key);
TestHelpers.draggable.shouldMove( el, "cancel: " + key );
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() {
expect( 2 );