aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Sherov <mike.sherov@gmail.com>2013-03-08 16:38:41 -0500
committerMike Sherov <mike.sherov@gmail.com>2013-03-08 16:52:49 -0500
commit8b1b34c5c3e8fae056f0880776156dc003b5e2c3 (patch)
treed295e97e37d6e5099b354ba35860eb1b398f6ab9
parent07ce771a13504b851bb9f74c8ce8e960d207384a (diff)
downloadjquery-ui-8b1b34c5c3e8fae056f0880776156dc003b5e2c3.tar.gz
jquery-ui-8b1b34c5c3e8fae056f0880776156dc003b5e2c3.zip
Sortable Tests: Add tests to support #9041 and #8792
-rw-r--r--tests/unit/sortable/sortable_events.js27
-rw-r--r--tests/unit/sortable/sortable_options.js37
2 files changed, 62 insertions, 2 deletions
diff --git a/tests/unit/sortable/sortable_events.js b/tests/unit/sortable/sortable_events.js
index 1b8165acb..46a493b3e 100644
--- a/tests/unit/sortable/sortable_events.js
+++ b/tests/unit/sortable/sortable_events.js
@@ -231,11 +231,34 @@ test("receive", function() {
test("remove", function() {
ok(false, "missing test - untested code is broken code.");
});
+*/
-test("over", function() {
- ok(false, "missing test - untested code is broken code.");
+test( "over", function() {
+ expect( 8 );
+
+ var hash,
+ overCount = 0;
+
+ $( "#sortable" ).sortable({
+ over: function( e, ui ) {
+ hash = ui;
+ overCount++;
+ }
+ }).find( "li:eq(0)" ).simulate( "drag", {
+ dy: 20
+ });
+
+ ok( hash, "stop event triggered" );
+ ok( hash.helper, "UI should not include: helper" );
+ ok( hash.placeholder, "UI hash includes: placeholder" );
+ ok( hash.position && ( "top" in hash.position && "left" in hash.position ), "UI hash includes: position" );
+ ok( hash.offset && ( hash.offset.top && hash.offset.left ), "UI hash includes: offset" );
+ ok( hash.item, "UI hash includes: item" );
+ ok( hash.sender, "UI hash does not include: sender" );
+ equal( overCount, 1, "over fires only once" );
});
+/*
test("out", function() {
ok(false, "missing test - untested code is broken code.");
});
diff --git a/tests/unit/sortable/sortable_options.js b/tests/unit/sortable/sortable_options.js
index caba0a777..638573162 100644
--- a/tests/unit/sortable/sortable_options.js
+++ b/tests/unit/sortable/sortable_options.js
@@ -37,7 +37,44 @@ test("{ cancel: 'input,textarea,button,select,option' }, default", function() {
test("{ cancel: Selector }", function() {
ok(false, "missing test - untested code is broken code.");
});
+*/
+
+test( "#8792: issues with floated items in connected lists", function() {
+ expect( 2 );
+
+ var element,
+ changeCount = 0;
+
+ $( "#qunit-fixture" )
+ .html( "<ul class='c'><li>a</li><li>a</li></ul><ul class='c'><li>a</li><li>a</li></ul>" )
+ .find( "ul" ).css({ "float": "left", width: "100px" }).end()
+ .find( "li" ).css({ "float": "left", width: "50px", height: "50px" });
+
+ $( "#qunit-fixture .c" ).sortable({
+ connectWith: "#qunit-fixture .c",
+ change: function() {
+ changeCount++;
+ }
+ });
+
+ element = $( "#qunit-fixture li:eq(0)" );
+ element.simulate( "drag", {
+ dx: 51,
+ moves: 15
+ });
+
+ equal( changeCount, 1, "change fired only once (no jitters) when dragging a floated sortable in it's own container" );
+
+ element.simulate( "drag", {
+ dx: 50,
+ moves: 15
+ });
+
+ equal( changeCount, 3, "change fired once for each expected change when dragging a floated sortable to a connected container" );
+});
+
+/*
test("{ connectWith: false }, default", function() {
ok(false, "missing test - untested code is broken code.");
});