mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Tests: extract TestHelpers.forceScrollableWindow for tests that need the window to scroll
This commit is contained in:
parent
52307ebadb
commit
67fd40eda7
@ -118,14 +118,11 @@ test( "#6258: not following mouse when scrolled and using overflow-y: scroll", f
|
|||||||
.scrollLeft( 0 );
|
.scrollLeft( 0 );
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
contentToForceScroll = $( "<div>" ).css({
|
|
||||||
height: "10000px",
|
|
||||||
width: "10000px"
|
|
||||||
}),
|
|
||||||
oldOverflowY = $( "html" ).css( "overflow-y" ),
|
oldOverflowY = $( "html" ).css( "overflow-y" ),
|
||||||
oldOverflowX = $( "html" ).css( "overflow-x" );
|
oldOverflowX = $( "html" ).css( "overflow-x" );
|
||||||
|
|
||||||
contentToForceScroll.appendTo( "#qunit-fixture" );
|
TestHelpers.forceScrollableWindow();
|
||||||
|
|
||||||
$( "html" )
|
$( "html" )
|
||||||
.css( "overflow-y", "scroll" )
|
.css( "overflow-y", "scroll" )
|
||||||
.css( "overflow-x", "scroll" )
|
.css( "overflow-x", "scroll" )
|
||||||
@ -148,13 +145,10 @@ test( "#9315: Draggable: jumps down with offset of scrollbar", function() {
|
|||||||
equal( ui.position.top, 11, "top position is correct when position is absolute" );
|
equal( ui.position.top, 11, "top position is correct when position is absolute" );
|
||||||
$( "html" ).scrollTop( 0 ).scrollLeft( 0 );
|
$( "html" ).scrollTop( 0 ).scrollLeft( 0 );
|
||||||
}
|
}
|
||||||
}),
|
|
||||||
contentToForceScroll = $( "<div>" ).css({
|
|
||||||
height: "10000px",
|
|
||||||
width: "10000px"
|
|
||||||
});
|
});
|
||||||
|
|
||||||
contentToForceScroll.appendTo( "#qunit-fixture" );
|
TestHelpers.forceScrollableWindow();
|
||||||
|
|
||||||
$( "html" ).scrollTop( 300 ).scrollLeft( 300 );
|
$( "html" ).scrollTop( 300 ).scrollLeft( 300 );
|
||||||
|
|
||||||
element.simulate( "drag", {
|
element.simulate( "drag", {
|
||||||
@ -178,13 +172,11 @@ test( "#5009: scroll not working with parent's position fixed", function() {
|
|||||||
equal( ui.position.top, 10, "top 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 );
|
$( document ).scrollTop( 0 ).scrollLeft( 0 );
|
||||||
}
|
}
|
||||||
}),
|
|
||||||
contentToForceScroll = $( "<div>" ).css({
|
|
||||||
height: "20000px",
|
|
||||||
width: "20000px"
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$( "#qunit-fixture" ).append( contentToForceScroll );
|
|
||||||
|
TestHelpers.forceScrollableWindow();
|
||||||
|
|
||||||
$( "#wrapper" ).css( "position", "fixed" );
|
$( "#wrapper" ).css( "position", "fixed" );
|
||||||
|
|
||||||
element.simulate( "drag", {
|
element.simulate( "drag", {
|
||||||
|
@ -40,12 +40,8 @@ test( "mousedown: initial position of helper", function() {
|
|||||||
|
|
||||||
var helperOffset,
|
var helperOffset,
|
||||||
element = $( "#selectable1" ).selectable(),
|
element = $( "#selectable1" ).selectable(),
|
||||||
contentToForceScroll = $( "<div>" ).css({
|
contentToForceScroll = TestHelpers.forceScrollableWindow( "body" );
|
||||||
height: "10000px",
|
|
||||||
width: "10000px"
|
|
||||||
});
|
|
||||||
|
|
||||||
contentToForceScroll.appendTo( "body" );
|
|
||||||
$( window ).scrollTop( 100 ).scrollLeft( 100 );
|
$( window ).scrollTop( 100 ).scrollLeft( 100 );
|
||||||
|
|
||||||
element.simulate( "mousedown", {
|
element.simulate( "mousedown", {
|
||||||
|
@ -191,6 +191,13 @@ TestHelpers.onFocus= function( element, onFocus ) {
|
|||||||
element.bind( "focus", fn )[ 0 ].focus();
|
element.bind( "focus", fn )[ 0 ].focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TestHelpers.forceScrollableWindow = function( appendTo ) {
|
||||||
|
return $( "<div>" ).css({
|
||||||
|
height: "10000px",
|
||||||
|
width: "10000px"
|
||||||
|
}).appendTo( appendTo || "#qunit-fixture" );
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Taken from https://github.com/jquery/qunit/tree/master/addons/close-enough
|
* Taken from https://github.com/jquery/qunit/tree/master/addons/close-enough
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user