Skip to content

Commit 9acb479

Browse files
committed
Draggable Tests: Fix IE8 test when native scroll happens
1 parent 1cfebf8 commit 9acb479

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

tests/unit/draggable/draggable_options.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -881,15 +881,34 @@ test( "scroll, scrollSensitivity, and scrollSpeed", function() {
881881
test( "scroll ignores containers that are overflow: hidden", function() {
882882
expect( 2 );
883883

884-
var element = $( "#draggable1" ).draggable({ scroll: true }).appendTo( "#scrollParent" );
884+
var scrollParent = $( "#scrollParent" ),
885+
element = $( "#draggable1" ).draggable().appendTo( scrollParent );
886+
887+
element.draggable( "option", "scroll", false );
888+
889+
element.simulate( "drag", {
890+
dx: 1300,
891+
dy: 1300
892+
});
893+
894+
// IE8 natively scrolls when dragging an element inside a overflow:hidden
895+
// container, so skip this test if native scroll occurs.
896+
// Support: IE <9
897+
if ( scrollParent.scrollTop() > 0 ) {
898+
ok( true, "overflow:hidden container natively scrolls" );
899+
ok( true, "overflow:hidden container natively scrolls" );
900+
return;
901+
}
902+
903+
element.css({ top: 0, left: 0 }).draggable( "option", "scroll", true );
885904

886905
element.simulate( "drag", {
887906
dx: 1300,
888907
dy: 1300
889908
});
890909

891-
equal( $( "#scrollParent" ).scrollTop(), 0, "container doesn't scroll vertically" );
892-
equal( $( "#scrollParent" ).scrollLeft(), 0, "container doesn't scroll horizontally" );
910+
equal( scrollParent.scrollTop(), 0, "container doesn't scroll vertically" );
911+
equal( scrollParent.scrollLeft(), 0, "container doesn't scroll horizontally" );
893912
});
894913

895914
test( "#6817: auto scroll goes double distance when dragging", function() {

0 commit comments

Comments
 (0)