Skip to content

Commit 5353c6b

Browse files
committed
Adding unit tests to make sure .scrollTop() and .scrollLeft() work cross-frame.
1 parent 1d35208 commit 5353c6b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/unit/offset.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ testoffset("table", function( jQuery ) {
300300
});
301301

302302
testoffset("scroll", function( jQuery, win ) {
303-
expect(12);
303+
expect(16);
304304

305305
var ie = jQuery.browser.msie && parseInt( jQuery.browser.version ) < 8;
306306

@@ -330,6 +330,14 @@ testoffset("scroll", function( jQuery, win ) {
330330

331331
equals( jQuery(win.document).scrollTop(), 1000, "jQuery(document).scrollTop()" );
332332
equals( jQuery(win.document).scrollLeft(), 1000, "jQuery(document).scrollLeft()" );
333+
334+
// test jQuery using parent window/document
335+
// jQuery reference here is in the iframe
336+
window.scrollTo(0,0);
337+
equals( jQuery(window).scrollTop(), 0, "jQuery(window).scrollTop() other window" );
338+
equals( jQuery(window).scrollLeft(), 0, "jQuery(window).scrollLeft() other window" );
339+
equals( jQuery(document).scrollTop(), 0, "jQuery(window).scrollTop() other document" );
340+
equals( jQuery(document).scrollLeft(), 0, "jQuery(window).scrollLeft() other document" );
333341
});
334342

335343
testoffset("body", function( jQuery ) {

0 commit comments

Comments
 (0)