Tests: test element position outside view

Ref 49833f7795
Ref gh-2828
Ref gh-2836
Fixes gh-2909
This commit is contained in:
Oleg Gaidarenko 2016-02-11 22:31:49 +03:00
parent 5943f1d7ff
commit a2f63ffd96
2 changed files with 42 additions and 0 deletions

View File

@ -130,3 +130,15 @@ section { background:#f0f; display:block; }
.inline { display: inline; }
.list-item { display: list-item; }
.hidden, .none { display: none; }
#div-gh-2836 {
position: relative;
overflow: auto;
height: 100px;
}
#div-gh-2836 div {
position: relative;
height: 100%;
padding: 0;
margin: 0;
}

View File

@ -471,4 +471,34 @@ QUnit.test( "allow modification of coordinates argument (gh-1848)", function( as
"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 );
} );
} )();