diff options
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/ajax.js | 14 | ||||
-rw-r--r-- | test/unit/animation.js | 6 | ||||
-rw-r--r-- | test/unit/event.js | 69 | ||||
-rw-r--r-- | test/unit/manipulation.js | 2 | ||||
-rw-r--r-- | test/unit/selector.js | 2 | ||||
-rw-r--r-- | test/unit/support.js | 16 |
6 files changed, 15 insertions, 94 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js index d20327b90..53dc9c5d2 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -1829,23 +1829,15 @@ QUnit.module( "ajax", { jQuery.each( { "If-Modified-Since": { - url: "mock.php?action=ims", - qunitMethod: "test" + url: "mock.php?action=ims" }, "Etag": { - url: "mock.php?action=etag", - - // Support: TestSwarm - // TestSwarm is now proxied via Cloudflare which cuts out - // headers relevant for ETag tests, failing them. We're still - // running those tests in Karma on Chrome & Firefox (including - // Firefox ESR). - qunitMethod: QUnit.isSwarm ? "skip" : "test" + url: "mock.php?action=etag" } }, function( type, data ) { var url = baseURL + data.url + "&ts=" + ifModifiedNow++; - QUnit[ data.qunitMethod ]( "jQuery.ajax() - " + type + + QUnit.test( "jQuery.ajax() - " + type + " support" + label, function( assert ) { assert.expect( 4 ); var done = assert.async(); diff --git a/test/unit/animation.js b/test/unit/animation.js index b282572b3..455c674a2 100644 --- a/test/unit/animation.js +++ b/test/unit/animation.js @@ -91,7 +91,7 @@ QUnit.test( "Animation.prefilter( fn ) - calls prefilter after defaultPrefilter" assert.expect( 1 ); var prefilter = this.sandbox.stub(), - defaultSpy = this.sandbox.spy( jQuery.Animation.prefilters, 0 ); + defaultSpy = this.sandbox.spy( jQuery.Animation.prefilters, "0" ); jQuery.Animation.prefilter( prefilter ); @@ -105,7 +105,7 @@ QUnit.test( "Animation.prefilter( fn, true ) - calls prefilter before defaultPre assert.expect( 1 ); var prefilter = this.sandbox.stub(), - defaultSpy = this.sandbox.spy( jQuery.Animation.prefilters, 0 ); + defaultSpy = this.sandbox.spy( jQuery.Animation.prefilters, "0" ); jQuery.Animation.prefilter( prefilter, true ); @@ -133,7 +133,7 @@ QUnit.test( "Animation.prefilter - prefilter return hooks", function( assert ) { assert.equal( arguments[ 2 ], this.opts, "third param opts" ); return ourAnimation; } ), - defaultSpy = sandbox.spy( jQuery.Animation.prefilters, 0 ), + defaultSpy = sandbox.spy( jQuery.Animation.prefilters, "0" ), queueSpy = sandbox.spy( function( next ) { next(); } ), diff --git a/test/unit/event.js b/test/unit/event.js index 2d49aa10c..38a805b37 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -2226,7 +2226,7 @@ QUnit.test( "window resize", function( assert ) { } ); QUnit.test( "focusin bubbles", function( assert ) { - assert.expect( 2 ); + assert.expect( 3 ); var input = jQuery( "<input type='text' />" ).prependTo( "body" ), order = 0; @@ -2242,14 +2242,13 @@ QUnit.test( "focusin bubbles", function( assert ) { assert.equal( 0, order++, "focusin on the element first" ); } ); -// Removed since DOM focus is unreliable on test swarm // DOM focus method -// input[ 0 ].focus(); + input[ 0 ].focus(); // To make the next focus test work, we need to take focus off the input. // This will fire another focusin event, so set order to reflect that. -// order = 1; -// jQuery( "#text1" )[ 0 ].focus(); + order = 1; + jQuery( "#text1" )[ 0 ].focus(); // jQuery trigger, which calls DOM focus order = 0; @@ -2276,13 +2275,12 @@ QUnit.test( "focus does not bubble", function( assert ) { assert.ok( true, "focus on the element" ); } ); -// Removed since DOM focus is unreliable on test swarm // DOM focus method -// input[ 0 ].focus(); + input[ 0 ].focus(); // To make the next focus test work, we need to take focus off the input. // This will fire another focusin event, so set order to reflect that. -// jQuery( "#text1" )[ 0 ].focus(); + jQuery( "#text1" )[ 0 ].focus(); // jQuery trigger, which calls DOM focus input.trigger( "focus" ); @@ -2717,15 +2715,7 @@ testIframe( // Remove body handler manually since it's outside the fixture jQuery( "body" ).off( "focusin.iframeTest" ); - setTimeout( function() { - - // DOM focus is unreliable in TestSwarm - if ( QUnit.isSwarm && !focus ) { - assert.ok( true, "GAP: Could not observe focus change" ); - } - - done(); - }, 50 ); + setTimeout( done, 50 ); } ); @@ -2748,11 +2738,6 @@ QUnit.test( "focusin on document & window", function( assert ) { input[ 0 ].blur(); - // DOM focus is unreliable in TestSwarm - if ( QUnit.isSwarm && counter === 0 ) { - assert.ok( true, "GAP: Could not observe focus change" ); - } - assert.strictEqual( counter, 2, "focusout handlers on document/window fired once only" ); @@ -3045,20 +3030,8 @@ QUnit.test( "preventDefault() on focusin does not throw exception", function( as "Preventing default on focusin throws no exception" ); done(); - done = null; } ); input.trigger( "focus" ); - - // DOM focus is unreliable in TestSwarm; set a simulated event workaround timeout - setTimeout( function() { - if ( !done ) { - return; - } - input[ 0 ].addEventListener( "click", function( nativeEvent ) { - jQuery.event.simulate( "focusin", this, jQuery.event.fix( nativeEvent ) ); - } ); - input[ 0 ].click(); - }, QUnit.config.testTimeout / 4 || 1000 ); } ); QUnit.test( ".on('focus', fn) on a text node doesn't throw", function( assert ) { @@ -3244,16 +3217,6 @@ QUnit.test( "focusout/focusin support", function( assert ) { // then lose it inputExternal[ 0 ].focus(); - // DOM focus is unreliable in TestSwarm - if ( QUnit.isSwarm && !focus ) { - assert.ok( true, "GAP: Could not observe focus change" ); - assert.ok( true, "GAP: Could not observe focus change" ); - assert.ok( true, "GAP: Could not observe focus change" ); - assert.ok( true, "GAP: Could not observe focus change" ); - assert.ok( true, "GAP: Could not observe focus change" ); - assert.ok( true, "GAP: Could not observe focus change" ); - } - // cleanup parent.off(); input.off(); @@ -3288,12 +3251,6 @@ QUnit.test( "focus-blur order (trac-12868)", function( assert ) { assert.equal( document.activeElement, $radio[ 0 ], "radio has focus" ); $text.trigger( "focus" ); - // DOM focus is unreliable in TestSwarm - if ( QUnit.isSwarm && order === 0 ) { - assert.ok( true, "GAP: Could not observe focus change" ); - assert.ok( true, "GAP: Could not observe focus change" ); - } - assert.equal( document.activeElement, $text[ 0 ], "text has focus" ); // Run handlers without native method on an input @@ -3341,18 +3298,6 @@ QUnit.test( "Event handling works with multiple async focus events (gh-4350)", f // gain focus input.trigger( "focus" ); - - // DOM focus is unreliable in TestSwarm - setTimeout( function() { - if ( QUnit.isSwarm && remaining === 3 ) { - assert.ok( true, "GAP: Could not observe focus change" ); - assert.ok( true, "GAP: Could not observe focus change" ); - assert.ok( true, "GAP: Could not observe focus change" ); - setTimeout( function() { - done(); - } ); - } - } ); } ); // Support: IE <=9 - 11+ diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 8be07c1df..a3ac18eef 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -2346,7 +2346,7 @@ testIframe( // Skip the the test if we are not in localhost but make sure we run // it in Karma. QUnit[ - includesModule( "ajax" ) && ( window.__karma__ || location.hostname === "localhost" ) ? + includesModule( "ajax" ) && location.hostname === "localhost" ? "test" : "skip" ]( "jQuery.append with crossorigin attribute", function( assert ) { diff --git a/test/unit/selector.js b/test/unit/selector.js index d6f28e25b..2a2481a05 100644 --- a/test/unit/selector.js +++ b/test/unit/selector.js @@ -537,7 +537,7 @@ QUnit.test( "attributes - existence", function( assert ) { assert.t( "On any element", "#qunit-fixture *[title]", [ "google" ] ); assert.t( "On implicit element", "#qunit-fixture [title]", [ "google" ] ); assert.t( "Boolean", "#select2 option[selected]", [ "option2d" ] ); - assert.t( "For attribute on label", "form label[for]", [ "label-for" ] ); + assert.t( "For attribute on label", "#qunit-fixture form label[for]", [ "label-for" ] ); } ); QUnit.test( "attributes - equals", function( assert ) { diff --git a/test/unit/support.js b/test/unit/support.js index f9ae2718e..c71d90ca4 100644 --- a/test/unit/support.js +++ b/test/unit/support.js @@ -90,10 +90,6 @@ testIframe( cssHas: true, reliableTrDimensions: true }, - webkit: { - cssHas: true, - reliableTrDimensions: true - }, firefox: { cssHas: true, reliableTrDimensions: false @@ -135,18 +131,6 @@ testIframe( expected = expectedMap.ios_15_4_16_3; } else if ( /\b(?:iphone|ipad);.*(?:iphone)? os \d+_/i.test( userAgent ) ) { expected = expectedMap.ios; - } else if ( typeof URLSearchParams !== "undefined" && - - // `karma-webkit-launcher` adds `test_browser=Playwright` to the query string. - // The normal way of using user agent to detect the browser won't help - // as on macOS Playwright doesn't specify the `Safari` token but on Linux - // it does. - // See https://github.com/google/karma-webkit-launcher#detected-if-safari-or-playwright-is-used - new URLSearchParams( document.referrer || window.location.search ).get( - "test_browser" - ) === "Playwright" - ) { - expected = expectedMap.webkit; } else if ( /\bversion\/(?:15|16\.[0123])(?:\.\d+)* safari/i.test( userAgent ) ) { expected = expectedMap.safari_16_3; } else if ( /\bversion\/\d+(?:\.\d+)+ safari/i.test( userAgent ) ) { |