aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2017-04-28 00:46:39 -0400
committerGitHub <noreply@github.com>2017-04-28 00:46:39 -0400
commitcc73471d0759924aef3c1ba002d9bd1fee559b8e (patch)
tree1015d13312e47b80512040827abffbf273c4c59a /test/unit
parent5aaa51455517a4f1433552b7d45e2de202276ecc (diff)
downloadjquery-cc73471d0759924aef3c1ba002d9bd1fee559b8e.tar.gz
jquery-cc73471d0759924aef3c1ba002d9bd1fee559b8e.zip
Tests: Reset iframe window scroll after updating html/document position
Ref 1d2df772b4d6e5dbf91df6e75f4a1809f7879ab0 Closes gh-3649
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/offset.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/unit/offset.js b/test/unit/offset.js
index c202b1d20..d56930924 100644
--- a/test/unit/offset.js
+++ b/test/unit/offset.js
@@ -31,7 +31,10 @@ var supportsFixedPosition, supportsScroll, alwaysScrollable,
null,
"offset/boxes.html",
function( assert, $, win, doc ) {
+ var scrollTop = win.pageYOffset,
+ scrollLeft = win.pageXOffset;
doc.documentElement.style.position = "fixed";
+ win.scrollTo( scrollLeft, scrollTop );
alwaysScrollable = win.pageXOffset !== 0;
done();
},
@@ -656,14 +659,18 @@ QUnit.test( "chaining", function( assert ) {
var label = "nonzero box properties - html." + htmlPos + " body." + bodyPos;
testIframe( label, "offset/boxes.html", function( assert, $, win, doc ) {
- // Define expectations at runtime so alwaysScrollable is correct
- var expectations = getExpectations( htmlPos, bodyPos );
+ var scrollTop = win.pageYOffset,
+ scrollLeft = win.pageXOffset,
+
+ // Define expectations at runtime so alwaysScrollable is correct
+ expectations = getExpectations( htmlPos, bodyPos );
assert.expect( 3 * Object.keys( expectations ).length );
- // Setup documentElement and body styles
+ // Setup documentElement and body styles, preserving scroll position
doc.documentElement.style.position = htmlPos;
doc.body.style.position = bodyPos;
+ win.scrollTo( scrollLeft, scrollTop );
// Verify expected document offset
supportjQuery.each( expectations, function( id, descriptor ) {