mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Tests: test element position outside view
Ref a0f5c357c4
Ref gh-2828
Ref gh-2836
Fixes gh-2909
This commit is contained in:
parent
a0f5c357c4
commit
c3b1d9c07e
@ -163,3 +163,15 @@ section { background:#f0f; display:block; }
|
|||||||
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#div-gh-2836 {
|
||||||
|
position: relative;
|
||||||
|
overflow: auto;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
#div-gh-2836 div {
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -497,4 +497,34 @@ QUnit.test( "allow modification of coordinates argument (gh-1848)", function( as
|
|||||||
"coordinates are modified (got offset.top: " + offsetTop + ")" );
|
"coordinates are modified (got offset.top: " + offsetTop + ")" );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
QUnit.test( "outside view position (gh-2836)", function( assert ) {
|
||||||
|
|
||||||
|
// This test ported from gh-2836 example
|
||||||
|
assert.expect( 1 );
|
||||||
|
|
||||||
|
var parent,
|
||||||
|
html = [
|
||||||
|
"<div id=div-gh-2836>",
|
||||||
|
"<div></div>",
|
||||||
|
"<div></div>",
|
||||||
|
"<div></div>",
|
||||||
|
"<div></div>",
|
||||||
|
"<div></div>",
|
||||||
|
"</div>"
|
||||||
|
].join( "" ),
|
||||||
|
stop = assert.async();
|
||||||
|
|
||||||
|
parent = $( html );
|
||||||
|
parent.appendTo( "#qunit-fixture" );
|
||||||
|
|
||||||
|
parent.one( "scroll", function() {
|
||||||
|
var pos = parent.find( "div" ).eq( 3 ).position();
|
||||||
|
|
||||||
|
assert.strictEqual(pos.top, -100);
|
||||||
|
stop();
|
||||||
|
});
|
||||||
|
|
||||||
|
parent.scrollTop( 400 );
|
||||||
|
} );
|
||||||
|
|
||||||
} )();
|
} )();
|
||||||
|
Loading…
Reference in New Issue
Block a user