From: Michał Gołębiowski Date: Sat, 7 Sep 2013 00:46:55 +0000 (+0200) Subject: Fix #14340. Remove remnants of oldIE from unit tests. Close gh-1425. X-Git-Tag: 2.1.0-beta2~22 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F1425%2Fhead;p=jquery.git Fix #14340. Remove remnants of oldIE from unit tests. Close gh-1425. --- diff --git a/test/data/testsuite.css b/test/data/testsuite.css index bcc2c0bc9..d4122643c 100644 --- a/test/data/testsuite.css +++ b/test/data/testsuite.css @@ -1,4 +1,3 @@ -/* for testing opacity set in styles in IE */ ol#empty { opacity: 0; } diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 08e1dc2dc..34040939f 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -590,8 +590,7 @@ test( "removeAttr(String)", function() { $first = jQuery("
"); equal( $first.attr("Case"), "mixed", "case of attribute doesn't matter" ); $first.removeAttr("Case"); - // IE 6/7 return empty string here, not undefined - ok( !$first.attr("Case"), "mixed-case attribute was removed" ); + equal( $first.attr( "Case" ), undefined, "mixed-case attribute was removed" ); }); test( "removeAttr(String) in XML", function() { diff --git a/test/unit/core.js b/test/unit/core.js index dd7ed1891..448f39b8b 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -409,7 +409,6 @@ test("isFunction", function() { // Firefox says this is a function ok( !jQuery.isFunction(obj), "Object Element" ); - // IE says this is an object // Since 1.3, this isn't supported (#2968) //ok( jQuery.isFunction(obj.getAttribute), "getAttribute Function" ); @@ -427,7 +426,6 @@ test("isFunction", function() { input.type = "text"; document.body.appendChild( input ); - // IE says this is an object // Since 1.3, this isn't supported (#2968) //ok( jQuery.isFunction(input.focus), "A default function property" ); diff --git a/test/unit/css.js b/test/unit/css.js index 4c1a9a241..9cef70be7 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -700,29 +700,22 @@ test("widows & orphans #8936", function () { var $p = jQuery("

").appendTo("#qunit-fixture"); - if ( "widows" in $p[0].style ) { - expect(4); - $p.css({ - "widows": 0, - "orphans": 0 - }); - - equal( $p.css("widows") || jQuery.style( $p[0], "widows" ), 0, "widows correctly start with value 0"); - equal( $p.css("orphans") || jQuery.style( $p[0], "orphans" ), 0, "orphans correctly start with value 0"); - - $p.css({ - "widows": 3, - "orphans": 3 - }); + expect( 4 ); + $p.css({ + "widows": 0, + "orphans": 0 + }); - equal( $p.css("widows") || jQuery.style( $p[0], "widows" ), 3, "widows correctly set to 3"); - equal( $p.css("orphans") || jQuery.style( $p[0], "orphans" ), 3, "orphans correctly set to 3"); - } else { + equal( $p.css( "widows" ) || jQuery.style( $p[0], "widows" ), 0, "widows correctly start with value 0" ); + equal( $p.css( "orphans" ) || jQuery.style( $p[0], "orphans" ), 0, "orphans correctly start with value 0" ); - expect(1); - ok( true, "jQuery does not attempt to test for style props that definitely don't exist in older versions of IE"); - } + $p.css({ + "widows": 3, + "orphans": 3 + }); + equal( $p.css( "widows" ) || jQuery.style( $p[0], "widows" ), 3, "widows correctly set to 3" ); + equal( $p.css( "orphans" ) || jQuery.style( $p[0], "orphans" ), 3, "orphans correctly set to 3" ); $p.remove(); }); @@ -761,12 +754,6 @@ test("can't get background-position in IE<9, see #10796", function() { } }); -test("percentage properties for bottom and right in IE<9 should not be incorrectly transformed to pixels, see #11311", function() { - expect( 1 ); - var div = jQuery("

").appendTo( "#qunit-fixture" ); - ok( window.getComputedStyle || div.css( "bottom" ) === "50%", "position properties get incorrectly transformed in IE<8, see #11311" ); -}); - if ( jQuery.fn.offset ) { test("percentage properties for left and top should be transformed to pixels, see #9505", function() { expect( 2 ); diff --git a/test/unit/effects.js b/test/unit/effects.js index 71228d7e4..6b251c4ca 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -355,17 +355,13 @@ test("animate table width/height", function() { test("animate table-row width/height", function() { expect(3); stop(); - var displayMode, - tr = jQuery("#table") + var tr = jQuery( "#table" ) .attr({ "cellspacing": 0, "cellpadding": 0, "border": 0 }) - .html("
") - .find("tr"); - - // IE<8 uses "block" instead of the correct display type - displayMode = tr.css("display") !== "table-row" ? "block" : "table-row"; + .html( "
" ) + .find( "tr" ); tr.animate({ width: 10, height: 10 }, 100, function() { - equal( jQuery(this).css("display"), displayMode, "display mode is correct" ); + equal( jQuery( this ).css( "display" ), "table-row", "display mode is correct" ); equal( this.offsetWidth, 20, "width animated to shrink wrap point" ); equal( this.offsetHeight, 20, "height animated to shrink wrap point" ); start(); @@ -375,17 +371,13 @@ test("animate table-row width/height", function() { test("animate table-cell width/height", function() { expect(3); stop(); - var displayMode, - td = jQuery("#table") + var td = jQuery( "#table" ) .attr({ "cellspacing": 0, "cellpadding": 0, "border": 0 }) - .html("
") - .find("td"); - - // IE<8 uses "block" instead of the correct display type - displayMode = td.css("display") !== "table-cell" ? "block" : "table-cell"; + .html( "
" ) + .find( "td" ); td.animate({ width: 10, height: 10 }, 100, function() { - equal( jQuery(this).css("display"), displayMode, "display mode is correct" ); + equal( jQuery( this ).css( "display" ), "table-cell", "display mode is correct" ); equal( this.offsetWidth, 20, "width animated to shrink wrap point" ); equal( this.offsetHeight, 20, "height animated to shrink wrap point" ); start(); @@ -990,16 +982,6 @@ jQuery.each({ f_o = f( elem, "opacity" ); } - // The only time an _empty_string_ will be matched is in IE - // otherwise, the correct values will be tested as usual - if ( f_o === "" ) { - f_o = 1; - } - // See above - if ( cur_o === "" ) { - cur_o = 1; - } - if ( t_o === "hide" || t_o === "show" ) { equal( cur_o, f_o, "Opacity must be reset to " + f_o + ": " + cur_o ); } diff --git a/test/unit/event.js b/test/unit/event.js index 225a22068..91ac98007 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -392,28 +392,15 @@ test("on bubbling, isDefaultPrevented", function() { $main = jQuery( "#qunit-fixture" ), fakeClick = function($jq) { // Use a native click so we don't get jQuery simulated bubbling - if ( document.createEvent ) { - var e = document.createEvent( "MouseEvents" ); - e.initEvent( "click", true, true ); - $jq[0].dispatchEvent(e); - } - else if ( $jq[0].click ) { - $jq[0].click(); // IE - } + var e = document.createEvent( "MouseEvents" ); + e.initEvent( "click", true, true ); + $jq[ 0 ].dispatchEvent( e ); }; $anchor2.on( "click", function(e) { e.preventDefault(); }); - $main.on("click", "#foo", function(e) { - var orig = e.originalEvent; - - if ( typeof(orig.defaultPrevented) === "boolean" || typeof(orig.returnValue) === "boolean" || orig["getPreventDefault"] ) { - equal( e.isDefaultPrevented(), true, "isDefaultPrevented true passed to bubbled event" ); - - } else { - // Opera < 11 doesn't implement any interface we can use, so give it a pass - ok( true, "isDefaultPrevented not supported by this browser, test skipped" ); - } + $main.on( "click", "#foo", function( e ) { + equal( e.isDefaultPrevented(), true, "isDefaultPrevented true passed to bubbled event" ); }); fakeClick( $anchor2 ); $anchor2.off( "click" ); @@ -1224,8 +1211,6 @@ test("trigger(eventObject, [data], [fn])", function() { equal( event.isDefaultPrevented(), false, "default not prevented" ); }); -// Explicitly introduce global variable for oldIE so QUnit doesn't complain if checking globals -window.onclick = undefined; test(".trigger() bubbling on disconnected elements (#10489)", function() { expect(2); diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index ca84d4bc1..b182a19b0 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -77,8 +77,7 @@ function testText( valueObj ) { equal( jQuery( j[ 0 ] ).text(), "hi!", "Check node,textnode,comment with text()" ); equal( j[ 1 ].nodeValue, " there ", "Check node,textnode,comment with text()" ); - // Blackberry 4.6 doesn't maintain comments in the DOM - equal( jQuery("#nonnodes")[ 0 ].childNodes.length < 3 ? 8 : j[ 2 ].nodeType, 8, "Check node,textnode,comment with text()" ); + equal( j[ 2 ].nodeType, 8, "Check node,textnode,comment with text()" ); // Update multiple elements #11809 expected = "New"; 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 diff --git a/test/unit/selector.js b/test/unit/selector.js index 7939ea350..176376da1 100644 --- a/test/unit/selector.js +++ b/test/unit/selector.js @@ -74,7 +74,7 @@ test("disconnected nodes - jQuery only", function() { }); testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQuery, window, document ) { - expect( 35 ); + expect( 38 ); /** * Returns an array of elements with the given IDs @@ -132,10 +132,10 @@ testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQue t( "Attribute Exists", "[indeterminate]", []); t( "Attribute Exists", "[ismap]", ["img1"]); t( "Attribute Exists", "[itemscope]", ["div1"]); - // t( "Attribute Exists", "[loop]", ["video1"]); // IE 6/7 cannot differentiate here. loop is also used on img, input, and marquee tags as well as video/audio. getAttributeNode unfortunately also retrieves the property value. + t( "Attribute Exists", "[loop]", ["video1"]); t( "Attribute Exists", "[multiple]", ["select1"]); t( "Attribute Exists", "[muted]", ["audio1"]); - // t( "Attribute Exists", "[nohref]", ["area1"]); // IE 6/7 keep this set to false regardless of presence. The attribute node is not retrievable. + t( "Attribute Exists", "[nohref]", ["area1"]); t( "Attribute Exists", "[noresize]", ["textarea1"]); t( "Attribute Exists", "[noshade]", ["hr1"]); t( "Attribute Exists", "[nowrap]", ["td1", "div1"]); @@ -157,7 +157,8 @@ testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQue }); t( "Enumerated attribute", "[spellcheck]", ["span1"]); - // t( "tabindex selector does not retrieve all elements in IE6/7(#8473)", "form, [tabindex]", ["form1", "text1"] ); // sigh, FF12 QSA mistakenly includes video elements even though they have no tabindex attribute (see https://bugzilla.mozilla.org/show_bug.cgi?id=618737) + t( "tabindex selector does not retrieve all elements in IE6/7 (#8473)", + "form, [tabindex]", [ "form1", "text1" ] ); t( "Improperly named form elements do not interfere with form selections (#9570)", "form[name='formName']", ["form1"] ); }); diff --git a/test/unit/wrap.js b/test/unit/wrap.js index 3de1c7931..68161b87b 100644 --- a/test/unit/wrap.js +++ b/test/unit/wrap.js @@ -49,7 +49,6 @@ function testWrap( val ) { j = jQuery("#nonnodes").contents(); j.wrap( val("") ); - // Blackberry 4.6 doesn't maintain comments in the DOM equal( jQuery("#nonnodes > i").length, jQuery("#nonnodes")[ 0 ].childNodes.length, "Check node,textnode,comment wraps ok" ); equal( jQuery("#nonnodes > i").text(), j.text(), "Check node,textnode,comment wraps doesn't hurt text" );