From 9b086888b803db872e8906cbdbf0de458231f225 Mon Sep 17 00:00:00 2001 From: Michał Gołębiowski Date: Thu, 25 Feb 2016 01:18:55 +0100 Subject: Docs:Tests: Remove obsolete code from tests, update support comments Support comments that were lacking the final IE/Edge version that exhibits the bug were checked & updated. Links to the Chromium bug tracker were updated. Code in tests related to unsupported browsers (like Android 2.3 in non-basic tests) has been removed. Fixes gh-2868 Closes gh-2949 --- test/unit/ajax.js | 20 +--------------- test/unit/basic.js | 25 ++++---------------- test/unit/css.js | 13 ++++------- test/unit/dimensions.js | 8 +++---- test/unit/effects.js | 8 +------ test/unit/event.js | 59 ++++++++++++++++++++--------------------------- test/unit/manipulation.js | 32 ++----------------------- test/unit/offset.js | 5 ++-- 8 files changed, 44 insertions(+), 126 deletions(-) (limited to 'test') diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 63f0edd9f..949bf5f20 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -249,9 +249,8 @@ QUnit.module( "ajax", { "Nullable": null, "undefined": undefined - // Support: Firefox + // Support: IE 9 - 11, Edge 12 - 13+ // Not all browsers allow empty-string headers - // https://bugzilla.mozilla.org/show_bug.cgi?id=815299 //"Empty": "" }, success: function( data, _, xhr ) { @@ -1699,16 +1698,6 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re } QUnit.asyncTest( "#11743 - jQuery.ajax() - script, throws exception", 1, function( assert ) { - - // Support: Android 2.3 only - // Android 2.3 doesn't fire the window.onerror handler, just accept the reality there. - if ( /android 2\.3/i.test( navigator.userAgent ) ) { - assert.ok( true, "Test skipped, Android 2.3 doesn't fire window.onerror for " + - "errors in dynamically included scripts" ); - QUnit.start(); - return; - } - var onerror = window.onerror; window.onerror = function() { assert.ok( true, "Exception thrown" ); @@ -1768,13 +1757,6 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re var parsedXML = jQuery( jQuery.parseXML( "blibli" ) ).find( "tab" ); ajaxXML = jQuery( ajaxXML ); try { - - // Android 2.3 doesn't automatically adopt nodes from foreign documents. - // (see the comment in test/manipulation.js) - // Support: Android 2.3 - if ( /android 2\.3/i.test( navigator.userAgent ) ) { - parsedXML = jQuery( ajaxXML[ 0 ].adoptNode( parsedXML[ 0 ] ) ); - } ajaxXML.find( "infowindowtab" ).append( parsedXML ); } catch ( e ) { assert.strictEqual( e, undefined, "error" ); diff --git a/test/unit/basic.js b/test/unit/basic.js index 8a3d19ae6..5a2f5abc2 100644 --- a/test/unit/basic.js +++ b/test/unit/basic.js @@ -187,10 +187,7 @@ QUnit.test( "manipulation", function( assert ) { assert.strictEqual( elem1.text( "foo" ).text(), "foo", ".html getter/setter" ); assert.strictEqual( - - // Support: IE 8 only - // IE 8 prints tag names in upper case. - elem1.html( "" ).html().toLowerCase(), + elem1.html( "" ).html(), "", ".html getter/setter" ); @@ -203,10 +200,7 @@ QUnit.test( "manipulation", function( assert ) { child.before( "" ); assert.strictEqual( - - // Support: IE 8 only - // IE 8 prints tag names in upper case. - elem1.html().toLowerCase(), + elem1.html(), "
", ".after/.before" ); @@ -275,10 +269,7 @@ QUnit.test( "wrap", function( assert ) { elem.find( "b" ).wrap( "" ); assert.strictEqual( - - // Support: IE 8 only - // IE 8 prints tag names in upper case. - elem.html().toLowerCase(), + elem.html(), "", ".wrap" ); @@ -286,10 +277,7 @@ QUnit.test( "wrap", function( assert ) { elem.find( "span" ).wrapInner( "" ); assert.strictEqual( - - // Support: IE 8 only - // IE 8 prints tag names in upper case. - elem.html().toLowerCase(), + elem.html(), "", ".wrapInner" ); @@ -297,10 +285,7 @@ QUnit.test( "wrap", function( assert ) { elem.find( "a" ).wrapAll( "" ); assert.strictEqual( - - // Support: IE 8 only - // IE 8 prints tag names in upper case. - elem.html().toLowerCase(), + elem.html(), "", ".wrapAll" ); diff --git a/test/unit/css.js b/test/unit/css.js index 4bad10205..43ce6ae19 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -1088,12 +1088,7 @@ QUnit.test( "Do not append px (#9548, #12990, #2792)", function( assert ) { $div.css( "fill-opacity", 1 ); - // Support: Android 2.3 (no support for fill-opacity) - if ( $div.css( "fill-opacity" ) !== undefined ) { - assert.equal( $div.css( "fill-opacity" ), 1, "Do not append px to 'fill-opacity'" ); - } else { - assert.ok( true, "No support for fill-opacity CSS property" ); - } + assert.equal( $div.css( "fill-opacity" ), 1, "Do not append px to 'fill-opacity'" ); $div.css( "column-count", 1 ); if ( $div.css( "column-count" ) !== undefined ) { @@ -1115,8 +1110,7 @@ QUnit.test( "Do not append px (#9548, #12990, #2792)", function( assert ) { QUnit.test( "css('width') and css('height') should respect box-sizing, see #11004", function( assert ) { assert.expect( 4 ); - // Support: Android 2.3 (-webkit-box-sizing). - var el_dis = jQuery( "
test
" ), + var el_dis = jQuery( "
test
" ), el = el_dis.clone().appendTo( "#qunit-fixture" ); assert.equal( el.css( "width" ), el.css( "width", el.css( "width" ) ).css( "width" ), "css('width') is not respecting box-sizing, see #11004" ); @@ -1189,7 +1183,8 @@ QUnit.test( "certain css values of 'normal' should be convertable to a number, s assert.equal( typeof el.css( "fontWeight" ), "string", ".css() returns a string" ); } ); -// only run this test in IE9 +// Support: IE 9 only +// Only run this test in IE9 if ( document.documentMode === 9 ) { QUnit.test( ".css('filter') returns a string in IE9, see #12537", function( assert ) { assert.expect( 1 ); diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js index 36de3f008..31c5aa48b 100644 --- a/test/unit/dimensions.js +++ b/test/unit/dimensions.js @@ -295,7 +295,7 @@ QUnit.test( "child of a hidden elem (or unconnected node) has accurate inner/out assert.equal( $divChild.outerWidth(), $divNormal.outerWidth(), "child of a hidden element outerWidth() is wrong see #9441" ); assert.equal( $divChild.outerWidth( true ), $divNormal.outerWidth( true ), "child of a hidden element outerWidth( true ) is wrong see #9300" ); - // Support: IE 10-11, Edge + // Support: IE 10 - 11, Edge 12 - 13+ // Child height is not always decimal assert.equal( $divChild.height().toFixed( 3 ), $divNormal.height().toFixed( 3 ), "child of a hidden element height() is wrong see #9441" ); assert.equal( $divChild.innerHeight().toFixed( 3 ), $divNormal.innerHeight().toFixed( 3 ), "child of a hidden element innerHeight() is wrong see #9441" ); @@ -308,7 +308,7 @@ QUnit.test( "child of a hidden elem (or unconnected node) has accurate inner/out assert.equal( $divUnconnected.outerWidth(), $divNormal.outerWidth(), "unconnected element outerWidth() is wrong see #9441" ); assert.equal( $divUnconnected.outerWidth( true ), $divNormal.outerWidth( true ), "unconnected element outerWidth( true ) is wrong see #9300" ); - // Support: IE 10-11, Edge + // Support: IE 10 - 11, Edge 12 - 13+ // Child height is not always decimal assert.equal( $divUnconnected.height().toFixed( 3 ), $divNormal.height().toFixed( 3 ), "unconnected element height() is wrong see #9441" ); assert.equal( $divUnconnected.innerHeight().toFixed( 3 ), $divNormal.innerHeight().toFixed( 3 ), "unconnected element innerHeight() is wrong see #9441" ); @@ -372,7 +372,7 @@ QUnit.test( "box-sizing:border-box child of a hidden elem (or unconnected node) assert.equal( $divChild.outerWidth(), $divNormal.outerWidth(), "child of a hidden element outerWidth() is wrong see #10413" ); assert.equal( $divChild.outerWidth( true ), $divNormal.outerWidth( true ), "child of a hidden element outerWidth( true ) is wrong see #10413" ); - // Support: IE 10-11, Edge + // Support: IE 10 - 11, Edge 12 - 13+ // Child height is not always decimal assert.equal( $divChild.height().toFixed( 3 ), $divNormal.height().toFixed( 3 ), "child of a hidden element height() is wrong see #10413" ); assert.equal( $divChild.innerHeight().toFixed( 3 ), $divNormal.innerHeight().toFixed( 3 ), "child of a hidden element innerHeight() is wrong see #10413" ); @@ -385,7 +385,7 @@ QUnit.test( "box-sizing:border-box child of a hidden elem (or unconnected node) assert.equal( $divUnconnected.outerWidth(), $divNormal.outerWidth(), "unconnected element outerWidth() is wrong see #10413" ); assert.equal( $divUnconnected.outerWidth( true ), $divNormal.outerWidth( true ), "unconnected element outerWidth( true ) is wrong see #10413" ); - // Support: IE 10-11, Edge + // Support: IE 10 - 11, Edge 12 - 13+ // Child height is not always decimal assert.equal( $divUnconnected.height().toFixed( 3 ), $divNormal.height().toFixed( 3 ), "unconnected element height() is wrong see #10413" ); assert.equal( $divUnconnected.innerHeight().toFixed( 3 ), $divNormal.innerHeight().toFixed( 3 ), "unconnected element innerHeight() is wrong see #10413" ); diff --git a/test/unit/effects.js b/test/unit/effects.js index ae43674bd..2f0ac9334 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -1389,13 +1389,7 @@ QUnit.test( "Do not append px to 'fill-opacity' #9548", function( assert ) { var $div = jQuery( "
" ).appendTo( "#qunit-fixture" ); $div.css( "fill-opacity", 0 ).animate( { "fill-opacity": 1.0 }, 0, function() { - - // Support: Android 2.3 (no support for fill-opacity) - if ( jQuery( this ).css( "fill-opacity" ) ) { - assert.equal( jQuery( this ).css( "fill-opacity" ), 1, "Do not append px to 'fill-opacity'" ); - } else { - assert.ok( true, "No support for fill-opacity CSS property" ); - } + assert.equal( jQuery( this ).css( "fill-opacity" ), 1, "Do not append px to 'fill-opacity'" ); $div.remove(); } ); } ); diff --git a/test/unit/event.js b/test/unit/event.js index fd7d86f7f..63b367ea8 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -431,20 +431,13 @@ QUnit.test( "on bubbling, isDefaultPrevented, stopImmediatePropagation", functio $anchor2.off( "click" ); $main.off( "click", "**" ); - // Android 2.3 doesn't support stopImmediatePropagation; jQuery fallbacks to stopPropagation - // in such a case. - // Support: Android 2.3 - if ( /android 2\.3/i.test( navigator.userAgent ) ) { - assert.ok( true, "Android 2.3, skipping native stopImmediatePropagation check" ); - } else { - $anchor2.on( "click", function( e ) { - e.stopImmediatePropagation(); - assert.ok( true, "anchor was clicked and prop stopped" ); - } ); - $anchor2[ 0 ].addEventListener( "click", neverCallMe, false ); - fakeClick( $anchor2 ); - $anchor2[ 0 ].removeEventListener( "click", neverCallMe ); - } + $anchor2.on( "click", function( e ) { + e.stopImmediatePropagation(); + assert.ok( true, "anchor was clicked and prop stopped" ); + } ); + $anchor2[ 0 ].addEventListener( "click", neverCallMe, false ); + fakeClick( $anchor2 ); + $anchor2[ 0 ].removeEventListener( "click", neverCallMe ); } ); QUnit.test( "on(), iframes", function( assert ) { @@ -1389,29 +1382,26 @@ QUnit.test( "Submit event can be stopped (#11049)", function( assert ) { form.remove(); } ); -// Test beforeunload event only if it supported. -// Support: iOS 7+, Android<4.0 -// iOS & old Android have the window.onbeforeunload field but don't support the beforeunload +// Support: iOS 7-9+ +// iOS has the window.onbeforeunload field but doesn't support the beforeunload // handler making it impossible to feature-detect the support. -if ( window.onbeforeunload === null && - !/(ipad|iphone|ipod|android 2\.3)/i.test( navigator.userAgent ) ) { - QUnit.test( "on(beforeunload)", 1, function( assert ) { - var iframe = jQuery( jQuery.parseHTML( "