diff options
Diffstat (limited to 'test/unit/support.js')
-rw-r--r-- | test/unit/support.js | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/test/unit/support.js b/test/unit/support.js index dc50700e8..aa3386ef8 100644 --- a/test/unit/support.js +++ b/test/unit/support.js @@ -70,6 +70,10 @@ testIframe( cssSupportsSelector: false, reliableTrDimensions: true }, + webkit: { + cssSupportsSelector: true, + reliableTrDimensions: true + }, firefox_102: { cssSupportsSelector: false, reliableTrDimensions: false @@ -97,14 +101,26 @@ testIframe( // Catches Edge, Chrome on Android & Opera as well. expected = expectedMap.chrome; - } else if ( /\b\d+(\.\d+)+ safari/i.test( userAgent ) ) { - expected = expectedMap.safari; } else if ( /firefox\/102\./i.test( userAgent ) ) { expected = expectedMap.firefox_102; } else if ( /firefox/i.test( userAgent ) ) { expected = expectedMap.firefox; } else if ( /(?: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 ( /\b\d+(\.\d+)+ safari/i.test( userAgent ) ) { + expected = expectedMap.safari; } QUnit.test( "Verify that support tests resolve as expected per browser", function( assert ) { @@ -134,7 +150,8 @@ testIframe( for ( i in expected ) { assert.equal( computedSupport[ i ], expected[ i ], "jQuery.support['" + i + "']: " + computedSupport[ i ] + - ", expected['" + i + "']: " + expected[ i ] ); + ", expected['" + i + "']: " + expected[ i ] + + ";\nUser Agent: " + navigator.userAgent ); } } ); |