aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMike Sherov <mike.sherov@gmail.com>2013-10-20 19:33:40 -0400
committerMike Sherov <mike.sherov@gmail.com>2013-10-20 19:46:05 -0400
commit94f8c4d5e9ef461973a504d65dd906c1120da71d (patch)
treef99a37641756c081ad6cb50ebdb66bf7017cc9fc /tests
parent9ca0a19a00640716e2387f42436324606ddd43ad (diff)
downloadjquery-ui-94f8c4d5e9ef461973a504d65dd906c1120da71d.tar.gz
jquery-ui-94f8c4d5e9ef461973a504d65dd906c1120da71d.zip
Draggable: apply axis options to position instead of style. Fixes #7251 - Draggable: constrained axis option returns incorrect position.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/draggable/draggable_options.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/unit/draggable/draggable_options.js b/tests/unit/draggable/draggable_options.js
index be7d665d4..1d6f6eab5 100644
--- a/tests/unit/draggable/draggable_options.js
+++ b/tests/unit/draggable/draggable_options.js
@@ -106,14 +106,28 @@ test( "{ axis: false }, default", function() {
});
test( "{ axis: 'x' }", function() {
- expect( 2 );
- var element = $( "#draggable2" ).draggable({ axis: "x" });
+ expect( 3 );
+ var element = $( "#draggable2" ).draggable({
+ axis: "x",
+ // TODO: remove the stop callback when all TestHelpers.draggable.testDrag bugs are fixed
+ stop: function( event, ui ) {
+ var expectedPosition = { left: ui.originalPosition.left + 50, top: ui.originalPosition.top };
+ deepEqual( ui.position, expectedPosition, "position dragged[50,0] for axis: x" );
+ }
+ });
TestHelpers.draggable.testDrag( element, element, 50, 50, 50, 0, "axis: x" );
});
test( "{ axis: 'y' }", function() {
- expect( 2 );
- var element = $( "#draggable2" ).draggable({ axis: "y" });
+ expect( 3 );
+ var element = $( "#draggable2" ).draggable({
+ axis: "y",
+ // TODO: remove the stop callback when all TestHelpers.draggable.testDrag bugs are fixed
+ stop: function( event, ui ) {
+ var expectedPosition = { left: ui.originalPosition.left, top: ui.originalPosition.top + 50 };
+ deepEqual( ui.position, expectedPosition, "position dragged[0,50] for axis: y" );
+ }
+ });
TestHelpers.draggable.testDrag( element, element, 50, 50, 0, 50, "axis: y" );
});