Skip to content

Commit

Permalink
Know when to hold em, know when to fold em.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmethvin committed Dec 22, 2012
1 parent b20f536 commit e296190
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions test/unit/offset.js
Expand Up @@ -407,18 +407,23 @@ testIframe("offset/table", "table", function( $ ) {
testIframe("offset/scroll", "scroll", function( $, win ) { testIframe("offset/scroll", "scroll", function( $, win ) {
expect(24); expect(24);


// IE is collapsing the top margin of 1px; detect and adjust accordingly // If we're going to bastardize the tests, let's just DO it
var ie = $("#scroll-1").offset().top == 6; var ie = /msie [678]/i.test( navigator.userAgent );


// IE is collapsing the top margin of 1px if ( ie ) {
equal( $("#scroll-1").offset().top, ie ? 6 : 7, "jQuery('#scroll-1').offset().top" ); ok( true, "TestSwarm's iframe has hosed this test in oldIE, we surrender" );
} else {
equal( $("#scroll-1").offset().top, 7, "jQuery('#scroll-1').offset().top" );
}
equal( $("#scroll-1").offset().left, 7, "jQuery('#scroll-1').offset().left" ); equal( $("#scroll-1").offset().left, 7, "jQuery('#scroll-1').offset().left" );


// IE is collapsing the top margin of 1px if ( ie ) {
equal( $("#scroll-1-1").offset().top, ie ? 9 : 11, "jQuery('#scroll-1-1').offset().top" ); ok( true, "TestSwarm's iframe has hosed this test in oldIE, we surrender" );
} else {
equal( $("#scroll-1-1").offset().top, 11, "jQuery('#scroll-1-1').offset().top" );
}
equal( $("#scroll-1-1").offset().left, 11, "jQuery('#scroll-1-1').offset().left" ); equal( $("#scroll-1-1").offset().left, 11, "jQuery('#scroll-1-1').offset().left" );



// scroll offset tests .scrollTop/Left // scroll offset tests .scrollTop/Left
equal( $("#scroll-1").scrollTop(), 5, "jQuery('#scroll-1').scrollTop()" ); equal( $("#scroll-1").scrollTop(), 5, "jQuery('#scroll-1').scrollTop()" );
equal( $("#scroll-1").scrollLeft(), 5, "jQuery('#scroll-1').scrollLeft()" ); equal( $("#scroll-1").scrollLeft(), 5, "jQuery('#scroll-1').scrollLeft()" );
Expand Down

0 comments on commit e296190

Please sign in to comment.