diff options
author | Mike Sherov <mike.sherov@gmail.com> | 2013-04-02 09:08:17 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2013-04-17 15:09:20 -0400 |
commit | 48b48a886576c427140e2c5549cff942dc6c79fa (patch) | |
tree | 11b98f5118a4ff09a5a764fd97bd4e9f54452421 /tests | |
parent | 9711c54c6d3d7ecffa9bfccc205522be1f4aa148 (diff) | |
download | jquery-ui-48b48a886576c427140e2c5549cff942dc6c79fa.tar.gz jquery-ui-48b48a886576c427140e2c5549cff942dc6c79fa.zip |
Draggable: Stop erroneously overriding scroll offsets for root nodes. Fixes #6258 - Draggable: not following mouse when scrolled and using overflow-y: scroll.
(cherry picked from commit a88d64514001867b908776e6bfcfac7f1011970d)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/draggable/draggable_core.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/unit/draggable/draggable_core.js b/tests/unit/draggable/draggable_core.js index f22d483a6..0d693e4ff 100644 --- a/tests/unit/draggable/draggable_core.js +++ b/tests/unit/draggable/draggable_core.js @@ -94,4 +94,39 @@ test( "#8269: Removing draggable element on drop", function() { }); }); +test( "#6258: not following mouse when scrolled and using overflow-y: scroll", function() { + expect( 2 ); + + var element = $( "#draggable1" ).draggable({ + stop: function( event, ui ) { + equal( ui.position.left, 1, "left position is correct despite overflow on HTML" ); + equal( ui.position.top, 1, "top position is correct despite overflow on HTML" ); + $( "html" ) + .css( "overflow-y", oldOverflowY ) + .css( "overflow-x", oldOverflowX ) + .scrollTop( 0 ) + .scrollLeft( 0 ); + } + }), + contentToForceScroll = $( "<div>" ).css({ + height: "10000px", + width: "10000px" + }), + oldOverflowY = $( "html" ).css( "overflow-y" ), + oldOverflowX = $( "html" ).css( "overflow-x" ); + + contentToForceScroll.appendTo( "#qunit-fixture" ); + $( "html" ) + .css( "overflow-y", "scroll" ) + .css( "overflow-x", "scroll" ) + .scrollTop( 300 ) + .scrollLeft( 300 ); + + element.simulate( "drag", { + dx: 1, + dy: 1, + moves: 1 + }); +}); + })( jQuery ); |