From: Aditya Raghavan Date: Sun, 21 Dec 2014 02:52:17 +0000 (-0500) Subject: Event: add test for window scrollTop/Left logic in iframes X-Git-Tag: 3.0.0-alpha1+compat~168 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2c14b00a863278bbee9817a2fd5e7f72560477a0;p=jquery.git Event: add test for window scrollTop/Left logic in iframes Ref d21edb599d8f5f80a3f3ecba5b62311b9cd1a3e6 --- 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()" ); +}); + })();