diff options
author | Scott González <scott.gonzalez@gmail.com> | 2015-04-07 10:55:52 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2015-04-09 09:27:00 -0400 |
commit | bde431bb449b1d957d4e0b736111ff342f2a919d (patch) | |
tree | 27fd40037c30dbff8ef3b6113e90817ab96b53bf /tests/unit/draggable/draggable_events.js | |
parent | dc4b015a8b9acdb5bff2d5dd89737b3d8b64097f (diff) | |
download | jquery-ui-bde431bb449b1d957d4e0b736111ff342f2a919d.tar.gz jquery-ui-bde431bb449b1d957d4e0b736111ff342f2a919d.zip |
Tests: Rename files
Ref gh-1528
Diffstat (limited to 'tests/unit/draggable/draggable_events.js')
-rw-r--r-- | tests/unit/draggable/draggable_events.js | 164 |
1 files changed, 0 insertions, 164 deletions
diff --git a/tests/unit/draggable/draggable_events.js b/tests/unit/draggable/draggable_events.js deleted file mode 100644 index ebbf606ef..000000000 --- a/tests/unit/draggable/draggable_events.js +++ /dev/null @@ -1,164 +0,0 @@ -define( [ - "jquery", - "ui/draggable" -], function( $ ) { - -var element; - -module( "draggable: events", { - setup: function() { - element = $("<div>").appendTo("#qunit-fixture"); - }, - teardown: function() { - element.draggable("destroy"); - } -}); - -test( "callbacks occurrence count", function() { - expect( 3 ); - - var start = 0, - stop = 0, - dragc = 0; - - element.draggable({ - start: function() { - start++; - }, - drag: function() { - dragc++; - }, - 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 ); - - var start = 0, - stop = 0, - dragc = 0; - - element.draggable({ - start: function() { - start++; - return false; - }, - drag: function() { - dragc++; - }, - 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 ); - - var start = 0, - stop = 0, - dragc = 0; - - element.draggable({ - start: function() { - start++; - }, - drag: function() { - dragc++; - return false; - }, - 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({ - 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 -test( "position and offset in hash is consistent between start, drag, and stop", function() { - expect( 4 ); - - var startPos, startOffset, dragPos, dragOffset, stopPos, stopOffset; - - element = $( "<div style='margin: 2px;'></div>" ).appendTo( "#qunit-fixture" ); - - element.draggable({ - start: function( event, ui ) { - startPos = ui.position; - startOffset = ui.offset; - }, - drag: function( event, ui ) { - dragPos = ui.position; - dragOffset = ui.offset; - }, - stop: function( event, ui ) { - stopPos = ui.position; - stopOffset = ui.offset; - } - }); - - element.simulate( "drag", { - dx: 10, - dy: 10, - moves: 1 - }); - - startPos.left += 10; - startPos.top += 10; - startOffset.left += 10; - startOffset.top += 10; - - deepEqual( startPos, dragPos, "start position equals drag position plus distance" ); - 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" ); -}); - -} ); |