Skip to content

Commit 2c14b00

Browse files
araghavamarkelog
authored andcommitted
Event: add test for window scrollTop/Left logic in iframes
Ref d21edb5
1 parent 6bc0e50 commit 2c14b00

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/unit/offset.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,4 +547,19 @@ test("fractions (see #7730 and #7885)", function() {
547547
div.remove();
548548
});
549549

550+
test("iframe scrollTop/Left (see gh-1945)", function() {
551+
expect( 2 );
552+
553+
// Tests scrollTop/Left with iframes
554+
var ifDoc = jQuery( "#iframe" )[ 0 ].contentDocument;
555+
jQuery( "#iframe" ).css( "width", "50px" ).css( "height", "50px" );
556+
ifDoc.write( "<div style='width: 1000px; height: 1000px;'></div>" );
557+
558+
jQuery( ifDoc ).scrollTop( 200 );
559+
jQuery( ifDoc ).scrollLeft( 500 );
560+
561+
equal( jQuery( ifDoc ).scrollTop(), 200, "$($('#iframe')[0].contentDocument).scrollTop()" );
562+
equal( jQuery( ifDoc ).scrollLeft(), 500, "$($('#iframe')[0].contentDocument).scrollLeft()" );
563+
});
564+
550565
})();

0 commit comments

Comments
 (0)