diff options
author | Alexander Schmitz <arschmitz@gmail.com> | 2015-08-24 08:59:44 -0400 |
---|---|---|
committer | Alexander Schmitz <arschmitz@gmail.com> | 2015-09-11 08:29:09 -0400 |
commit | 8336ba7b694fbf85ec893ce79343a9f510a1e0b0 (patch) | |
tree | 19894ab900093e0291fecf27e1cfcadb8491e6b9 /tests/unit/draggable/events.js | |
parent | 0cab9f0a2f1f91ae671d57dba5e5bdcde1f60622 (diff) | |
download | jquery-ui-8336ba7b694fbf85ec893ce79343a9f510a1e0b0.tar.gz jquery-ui-8336ba7b694fbf85ec893ce79343a9f510a1e0b0.zip |
Draggable: Style updates
Ref #14246
Diffstat (limited to 'tests/unit/draggable/events.js')
-rw-r--r-- | tests/unit/draggable/events.js | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/tests/unit/draggable/events.js b/tests/unit/draggable/events.js index 7e276092b..36a5a8705 100644 --- a/tests/unit/draggable/events.js +++ b/tests/unit/draggable/events.js @@ -7,12 +7,12 @@ var element; module( "draggable: events", { setup: function() { - element = $("<div>").appendTo("#qunit-fixture"); + element = $( "<div>" ).appendTo( "#qunit-fixture" ); }, teardown: function() { - element.draggable("destroy"); + element.draggable( "destroy" ); } -}); +} ); test( "callbacks occurrence count", function() { expect( 3 ); @@ -21,7 +21,7 @@ test( "callbacks occurrence count", function() { stop = 0, dragc = 0; - element.draggable({ + element.draggable( { start: function() { start++; }, @@ -31,17 +31,17 @@ test( "callbacks occurrence count", function() { stop: function() { stop++; } - }); + } ); element.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" ); equal( stop, 1, "stop callback should happen exactly once" ); -}); +} ); test( "stopping the start callback", function() { expect( 3 ); @@ -50,7 +50,7 @@ test( "stopping the start callback", function() { stop = 0, dragc = 0; - element.draggable({ + element.draggable( { start: function() { start++; return false; @@ -61,17 +61,17 @@ test( "stopping the start callback", function() { stop: function() { stop++; } - }); + } ); element.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" ); equal( stop, 0, "stop callback should not happen if there wasnt even a start" ); -}); +} ); test( "stopping the drag callback", function() { expect( 2 ); @@ -80,7 +80,7 @@ test( "stopping the drag callback", function() { stop = 0, dragc = 0; - element.draggable({ + element.draggable( { start: function() { start++; }, @@ -91,34 +91,34 @@ test( "stopping the drag callback", function() { stop: function() { stop++; } - }); + } ); element.simulate( "drag", { dx: 10, dy: 10 - }); + } ); 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() { expect( 1 ); - element.draggable({ + element.draggable( { helper: "clone", stop: function() { return false; } - }); + } ); element.simulate( "drag", { dx: 10, dy: 10 - }); + } ); ok( element.draggable( "instance" ).helper, "the clone should not be deleted if the stop callback is stopped" ); -}); +} ); // http://bugs.jqueryui.com/ticket/6884 // Draggable: ui.offset.left differs between the "start" and "drag" hooks @@ -129,7 +129,7 @@ test( "position and offset in hash is consistent between start, drag, and stop", element = $( "<div style='margin: 2px;'></div>" ).appendTo( "#qunit-fixture" ); - element.draggable({ + element.draggable( { start: function( event, ui ) { startPos = ui.position; startOffset = ui.offset; @@ -142,13 +142,13 @@ test( "position and offset in hash is consistent between start, drag, and stop", stopPos = ui.position; stopOffset = ui.offset; } - }); + } ); element.simulate( "drag", { dx: 10, dy: 10, moves: 1 - }); + } ); startPos.left += 10; startPos.top += 10; @@ -159,6 +159,6 @@ test( "position and offset in hash is consistent between start, drag, and stop", deepEqual( dragPos, stopPos, "drag position equals stop position" ); deepEqual( startOffset, dragOffset, "start offset equals drag offset plus distance" ); deepEqual( dragOffset, stopOffset, "drag offset equals stop offset" ); -}); +} ); } ); |