diff options
author | Mike Sherov <mike.sherov@gmail.com> | 2014-08-13 22:26:04 -0400 |
---|---|---|
committer | Mike Sherov <mike.sherov@gmail.com> | 2014-08-13 22:26:04 -0400 |
commit | 9acb4797facf55fe2a268b1a87890decb284da50 (patch) | |
tree | 41b684f54a051b6d5d384351ccbeb0e937510356 /tests/unit/draggable/draggable_options.js | |
parent | 1cfebf803beedef05e8dcdd54e34d10c412a9a2b (diff) | |
download | jquery-ui-9acb4797facf55fe2a268b1a87890decb284da50.tar.gz jquery-ui-9acb4797facf55fe2a268b1a87890decb284da50.zip |
Draggable Tests: Fix IE8 test when native scroll happens
Diffstat (limited to 'tests/unit/draggable/draggable_options.js')
-rw-r--r-- | tests/unit/draggable/draggable_options.js | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/tests/unit/draggable/draggable_options.js b/tests/unit/draggable/draggable_options.js index 99fd608bf..f59a33693 100644 --- a/tests/unit/draggable/draggable_options.js +++ b/tests/unit/draggable/draggable_options.js @@ -881,15 +881,34 @@ test( "scroll, scrollSensitivity, and scrollSpeed", function() { test( "scroll ignores containers that are overflow: hidden", function() { expect( 2 ); - var element = $( "#draggable1" ).draggable({ scroll: true }).appendTo( "#scrollParent" ); + var scrollParent = $( "#scrollParent" ), + element = $( "#draggable1" ).draggable().appendTo( scrollParent ); + + element.draggable( "option", "scroll", false ); + + element.simulate( "drag", { + dx: 1300, + dy: 1300 + }); + + // IE8 natively scrolls when dragging an element inside a overflow:hidden + // container, so skip this test if native scroll occurs. + // Support: IE <9 + if ( scrollParent.scrollTop() > 0 ) { + ok( true, "overflow:hidden container natively scrolls" ); + ok( true, "overflow:hidden container natively scrolls" ); + return; + } + + element.css({ top: 0, left: 0 }).draggable( "option", "scroll", true ); element.simulate( "drag", { dx: 1300, dy: 1300 }); - equal( $( "#scrollParent" ).scrollTop(), 0, "container doesn't scroll vertically" ); - equal( $( "#scrollParent" ).scrollLeft(), 0, "container doesn't scroll horizontally" ); + equal( scrollParent.scrollTop(), 0, "container doesn't scroll vertically" ); + equal( scrollParent.scrollLeft(), 0, "container doesn't scroll horizontally" ); }); test( "#6817: auto scroll goes double distance when dragging", function() { |