diff options
author | Oleg Gaidarenko <markelog@gmail.com> | 2016-02-11 22:31:49 +0300 |
---|---|---|
committer | Oleg Gaidarenko <markelog@gmail.com> | 2016-02-11 22:59:09 +0300 |
commit | a2f63ffd9640ce1e13465f718b1e2c6ca87f8772 (patch) | |
tree | cb0e60c61b0db6d6a99fbd33b7c32cf42a918860 /test/unit | |
parent | 5943f1d7ffef41cc1a99bffe189f6d111fbccfd0 (diff) | |
download | jquery-a2f63ffd9640ce1e13465f718b1e2c6ca87f8772.tar.gz jquery-a2f63ffd9640ce1e13465f718b1e2c6ca87f8772.zip |
Tests: test element position outside view
Ref 49833f7795d665ff1d543c4f71f29fca95b567e9
Ref gh-2828
Ref gh-2836
Fixes gh-2909
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/dimensions.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js index c681478a0..0b568dd86 100644 --- a/test/unit/dimensions.js +++ b/test/unit/dimensions.js @@ -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 ); +} ); + } )(); |