diff options
author | Mike Sherov <mike.sherov@gmail.com> | 2014-08-23 15:34:04 -0400 |
---|---|---|
committer | Mike Sherov <mike.sherov@gmail.com> | 2014-08-23 15:34:04 -0400 |
commit | df7e32fe3798562ffb86d064444f1e0cc8ac59a8 (patch) | |
tree | 67fe94208acb8210e369608071a33715adf7b714 /tests/unit | |
parent | 95546c5d045f8055b121f24d3e35468e2a570c1b (diff) | |
download | jquery-ui-df7e32fe3798562ffb86d064444f1e0cc8ac59a8.tar.gz jquery-ui-df7e32fe3798562ffb86d064444f1e0cc8ac59a8.zip |
Draggable: Check all parents for fixed positioning when scrolling
Fixes #9612
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/draggable/draggable_core.js | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/tests/unit/draggable/draggable_core.js b/tests/unit/draggable/draggable_core.js index de88b1947..81c31e22f 100644 --- a/tests/unit/draggable/draggable_core.js +++ b/tests/unit/draggable/draggable_core.js @@ -182,25 +182,33 @@ test( "#9315: jumps down with offset of scrollbar", function() { }); }); -test( "#5009: scroll not working with parent's position fixed", function() { +test( "scroll offset with fixed ancestors", function() { expect( 2 ); var startValue = 300, - element = $( "#draggable1" ).wrap( "<div id='wrapper' />" ).draggable({ - drag: function() { - startValue += 100; - $( document ).scrollTop( startValue ).scrollLeft( startValue ); - }, - stop: function( event, ui ) { - equal( ui.position.left, 10, "left position is correct when parent position is fixed" ); - equal( ui.position.top, 10, "top position is correct when parent position is fixed" ); - $( document ).scrollTop( 0 ).scrollLeft( 0 ); - } - }); + element = $( "#draggable1" ) + // http://bugs.jqueryui.com/ticket/5009 + // scroll not working with parent's position fixed + .wrap( "<div id='wrapper' />" ) + // http://bugs.jqueryui.com/ticket/9612 + // abspos elements inside of fixed elements moving away from the mouse when scrolling + .wrap( "<div id='wrapper2' />" ) + .draggable({ + drag: function() { + startValue += 100; + $( document ).scrollTop( startValue ).scrollLeft( startValue ); + }, + stop: function( event, ui ) { + equal( ui.position.left, 10, "left position is correct when parent position is fixed" ); + equal( ui.position.top, 10, "top position is correct when parent position is fixed" ); + $( document ).scrollTop( 0 ).scrollLeft( 0 ); + } + }); TestHelpers.forceScrollableWindow(); $( "#wrapper" ).css( "position", "fixed" ); + $( "#wrapper2" ).css( "position", "absolute" ); element.simulate( "drag", { dx: 10, |