From 2c14b00a863278bbee9817a2fd5e7f72560477a0 Mon Sep 17 00:00:00 2001 From: Aditya Raghavan Date: Sat, 20 Dec 2014 21:52:17 -0500 Subject: [PATCH] Event: add test for window scrollTop/Left logic in iframes Ref d21edb599d8f5f80a3f3ecba5b62311b9cd1a3e6 --- test/unit/offset.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/unit/offset.js b/test/unit/offset.js index e1ea9a234..dc56f06ec 100644 --- a/test/unit/offset.js +++ b/test/unit/offset.js @@ -547,4 +547,19 @@ test("fractions (see #7730 and #7885)", function() { div.remove(); }); +test("iframe scrollTop/Left (see gh-1945)", function() { + expect( 2 ); + + // Tests scrollTop/Left with iframes + var ifDoc = jQuery( "#iframe" )[ 0 ].contentDocument; + jQuery( "#iframe" ).css( "width", "50px" ).css( "height", "50px" ); + ifDoc.write( "
" ); + + jQuery( ifDoc ).scrollTop( 200 ); + jQuery( ifDoc ).scrollLeft( 500 ); + + equal( jQuery( ifDoc ).scrollTop(), 200, "$($('#iframe')[0].contentDocument).scrollTop()" ); + equal( jQuery( ifDoc ).scrollLeft(), 500, "$($('#iframe')[0].contentDocument).scrollLeft()" ); +}); + })(); -- 2.39.5