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:55:34 +0300 |
commit | 30202be6e1730d46eec1966e2d78db7860935df9 (patch) | |
tree | 3c518492b7a92f4be618b2fe4d163e6095e09d54 | |
parent | ee0f61647cb93d587764280b1278807d9ff86fc9 (diff) | |
download | jquery-30202be6e1730d46eec1966e2d78db7860935df9.tar.gz jquery-30202be6e1730d46eec1966e2d78db7860935df9.zip |
Tests: test element position outside view
Ref ee0f61647cb93d587764280b1278807d9ff86fc9
Ref gh-2828
Ref gh-2836
Fixes gh-2909
-rw-r--r-- | test/data/testsuite.css | 12 | ||||
-rw-r--r-- | test/unit/dimensions.js | 30 |
2 files changed, 42 insertions, 0 deletions
diff --git a/test/data/testsuite.css b/test/data/testsuite.css index cf2ba8c20..3dbf834fd 100644 --- a/test/data/testsuite.css +++ b/test/data/testsuite.css @@ -142,3 +142,15 @@ section { background:#f0f; display:block; } #span-14824 { display: block; } #display { display: list-item !important; } + +#div-gh-2836 { + position: relative; + overflow: auto; + height: 100px; +} +#div-gh-2836 div { + position: relative; + height: 100%; + padding: 0; + margin: 0; +} diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js index 44a729113..af269de90 100644 --- a/test/unit/dimensions.js +++ b/test/unit/dimensions.js @@ -473,4 +473,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 ); +} ); + } )(); |