aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/draggable/draggable_options.js
diff options
context:
space:
mode:
authorWoody Gilk <shadowhand@deviantart.com>2013-03-14 13:21:24 -0500
committerMike Sherov <mike.sherov@gmail.com>2013-03-15 18:52:56 -0400
commit82f588e82b887fdcb2406da2c5dfedc2f13ebdc9 (patch)
tree43429213423ba16b6e7bdb1b0944633008840be2 /tests/unit/draggable/draggable_options.js
parent39a2f465a54d93777781c1a97cb58953a7d6557e (diff)
downloadjquery-ui-82f588e82b887fdcb2406da2c5dfedc2f13ebdc9.tar.gz
jquery-ui-82f588e82b887fdcb2406da2c5dfedc2f13ebdc9.zip
Draggable: Fix double offset bug when scrolling. Fixes #6817 - Draggable: auto scroll goes double distance when dragging
Diffstat (limited to 'tests/unit/draggable/draggable_options.js')
-rw-r--r--tests/unit/draggable/draggable_options.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/unit/draggable/draggable_options.js b/tests/unit/draggable/draggable_options.js
index a71bf57cb..83fbc1712 100644
--- a/tests/unit/draggable/draggable_options.js
+++ b/tests/unit/draggable/draggable_options.js
@@ -1103,6 +1103,40 @@ test( "scroll, scrollSensitivity, and scrollSpeed", function() {
TestHelpers.draggable.restoreScroll( document );
});
+test( "#6817: auto scroll goes double distance when dragging", function() {
+ expect( 2 );
+
+ var offsetBefore,
+ distance = 10,
+ viewportHeight = $( window ).height(),
+ element = $( "#draggable1" ).draggable({
+ scroll: true,
+ stop: function( e, ui ) {
+ equal( ui.offset.top, newY, "offset of item matches pointer position after scroll" );
+ equal( ui.offset.top - offsetBefore.top, distance, "offset of item only moves expected distance after scroll" );
+ }
+ }),
+ scrollSensitivity = element.draggable( "option", "scrollSensitivity" ),
+ oldY = viewportHeight - scrollSensitivity,
+ newY = oldY + distance;
+
+ element.offset({
+ top: oldY,
+ left: 1
+ });
+
+ offsetBefore = element.offset();
+
+ element.simulate( "drag", {
+ handle: "corner",
+ dx: 1,
+ y: newY,
+ moves: 1
+ });
+
+ TestHelpers.draggable.restoreScroll( document );
+});
+
test( "snap, snapMode, and snapTolerance", function() {
expect( 9 );