aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/offset.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/offset.js')
-rw-r--r--test/unit/offset.js70
1 files changed, 23 insertions, 47 deletions
diff --git a/test/unit/offset.js b/test/unit/offset.js
index f1e33bd4b..2c21f5055 100644
--- a/test/unit/offset.js
+++ b/test/unit/offset.js
@@ -181,16 +181,11 @@ testIframe("offset/absolute", "absolute", function( $ ) {
testIframe("offset/relative", "relative", function( $ ) {
expect(60);
- var ie, tests;
-
- // IE is collapsing the top margin of 1px; detect and adjust accordingly
- ie = $("#relative-1").offset().top === 6;
-
// get offset
- tests = [
- { "id": "#relative-1", "top": ie ? 6 : 7, "left": 7 },
- { "id": "#relative-1-1", "top": ie ? 13 : 15, "left": 15 },
- { "id": "#relative-2", "top": ie ? 141 : 142, "left": 27 }
+ var tests = [
+ { "id": "#relative-1", "top": 7, "left": 7 },
+ { "id": "#relative-1-1", "top": 15, "left": 15 },
+ { "id": "#relative-2", "top": 142, "left": 27 }
];
jQuery.each( tests, function() {
equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset().top" );
@@ -200,9 +195,9 @@ testIframe("offset/relative", "relative", function( $ ) {
// get position
tests = [
- { "id": "#relative-1", "top": ie ? 5 : 6, "left": 6 },
- { "id": "#relative-1-1", "top": ie ? 4 : 5, "left": 5 },
- { "id": "#relative-2", "top": ie ? 140 : 141, "left": 26 }
+ { "id": "#relative-1", "top": 6, "left": 6 },
+ { "id": "#relative-1-1", "top": 5, "left": 5 },
+ { "id": "#relative-2", "top": 141, "left": 26 }
];
jQuery.each( tests, function() {
equal( $( this["id"] ).position().top, this["top"], "jQuery('" + this["id"] + "').position().top" );
@@ -244,17 +239,12 @@ testIframe("offset/relative", "relative", function( $ ) {
testIframe("offset/static", "static", function( $ ) {
expect( 80 );
- var ie, tests;
-
- // IE is collapsing the top margin of 1px; detect and adjust accordingly
- ie = $("#static-1").offset().top === 6;
-
// get offset
- tests = [
- { "id": "#static-1", "top": ie ? 6 : 7, "left": 7 },
- { "id": "#static-1-1", "top": ie ? 13 : 15, "left": 15 },
- { "id": "#static-1-1-1", "top": ie ? 20 : 23, "left": 23 },
- { "id": "#static-2", "top": ie ? 121 : 122, left: 7 }
+ var tests = [
+ { "id": "#static-1", "top": 7, "left": 7 },
+ { "id": "#static-1-1", "top": 15, "left": 15 },
+ { "id": "#static-1-1-1", "top": 23, "left": 23 },
+ { "id": "#static-2", "top": 122, left: 7 }
];
jQuery.each( tests, function() {
equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset().top" );
@@ -264,10 +254,10 @@ testIframe("offset/static", "static", function( $ ) {
// get position
tests = [
- { "id": "#static-1", "top": ie ? 5 : 6, "left": 6 },
- { "id": "#static-1-1", "top": ie ? 12 : 14, "left": 14 },
- { "id": "#static-1-1-1", "top": ie ? 19 : 22, "left": 22 },
- { "id": "#static-2", "top": ie ? 120 : 121, "left": 6 }
+ { "id": "#static-1", "top": 6, "left": 6 },
+ { "id": "#static-1-1", "top": 14, "left": 14 },
+ { "id": "#static-1-1-1", "top": 22, "left": 22 },
+ { "id": "#static-2", "top": 121, "left": 6 }
];
jQuery.each( tests, function() {
equal( $( this["id"] ).position().top, this["top"], "jQuery('" + this["top"] + "').position().top" );
@@ -313,25 +303,22 @@ testIframe("offset/static", "static", function( $ ) {
testIframe("offset/fixed", "fixed", function( $ ) {
expect(34);
- var ie, tests, $noTopLeft;
-
- // IE is collapsing the top margin of 1px; detect and adjust accordingly
- ie = $("#fixed-1").position().top === 2;
+ var tests, $noTopLeft;
tests = [
{
"id": "#fixed-1",
"offsetTop": 1001,
"offsetLeft": 1001,
- "positionTop": ie ? 2 : 0,
- "positionLeft": ie ? 2 : 0
+ "positionTop": 0,
+ "positionLeft": 0
},
{
"id": "#fixed-2",
"offsetTop": 1021,
"offsetLeft": 1021,
- "positionTop": ie ? 22 : 20,
- "positionLeft": ie ? 22 : 20
+ "positionTop": 20,
+ "positionLeft": 20
}
];
@@ -413,21 +400,10 @@ testIframe("offset/table", "table", function( $ ) {
testIframe("offset/scroll", "scroll", function( $, win ) {
expect(24);
- // If we're going to bastardize the tests, let's just DO it
- var ie = /msie [678]/i.test( navigator.userAgent );
-
- if ( ie ) {
- 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().top, 7, "jQuery('#scroll-1').offset().top" );
equal( $("#scroll-1").offset().left, 7, "jQuery('#scroll-1').offset().left" );
- if ( ie ) {
- 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().top, 11, "jQuery('#scroll-1-1').offset().top" );
equal( $("#scroll-1-1").offset().left, 11, "jQuery('#scroll-1-1').offset().left" );
// scroll offset tests .scrollTop/Left