aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2024-05-29 18:32:27 +0200
committerGitHub <noreply@github.com>2024-05-29 18:32:27 +0200
commitb6f53def96d31d07e16eb40c290fcf1705d52156 (patch)
treec65924f2de1a1a4e0a0d8c7c0a22237f79759121
parenta5bac65e0ccbb4bdb7069bc709f0852fcdbbdddc (diff)
downloadjquery-b6f53def96d31d07e16eb40c290fcf1705d52156.tar.gz
jquery-b6f53def96d31d07e16eb40c290fcf1705d52156.zip
Tests: Make `:has` selector tests not vulnerable to unrelated failures
Use `assert.selectInFixture` consistently in `:has` tests. Previously, any test failure that happened before this test run made it fail due to an additional paragraph with id `qunit-testresult` injected by QUnit. Closes gh-5497
-rw-r--r--test/unit/selector.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/unit/selector.js b/test/unit/selector.js
index befc3c618..9867aaf18 100644
--- a/test/unit/selector.js
+++ b/test/unit/selector.js
@@ -986,10 +986,10 @@ QUnit.test( "pseudo - nth-last-of-type", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "pseudo - has", function( assert ) {
assert.expect( 4 );
- assert.t( "Basic test", "p:has(a)", [ "firstp", "ap", "en", "sap" ] );
- assert.t( "Basic test (irrelevant whitespace)", "p:has( a )", [ "firstp", "ap", "en", "sap" ] );
- assert.t( "Nested with overlapping candidates",
- "#qunit-fixture div:has(div:has(div:not([id])))",
+ assert.selectInFixture( "Basic test", "p:has(a)", [ "firstp", "ap", "en", "sap" ] );
+ assert.selectInFixture( "Basic test (irrelevant whitespace)", "p:has( a )", [ "firstp", "ap", "en", "sap" ] );
+ assert.selectInFixture( "Nested with overlapping candidates",
+ "div:has(div:has(div:not([id])))",
[ "moretests", "t2037", "fx-test-group", "fx-queue" ] );
// Support: Safari 15.4+, Chrome 105+
@@ -998,8 +998,8 @@ QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "pseudo - has", function( asse
// return no results. Make sure this is accounted for. (gh-5098)
// Note: Chrome 105 has this behavior only in 105.0.5195.125 or newer;
// initially it shipped with a fully forgiving parsing in `:has()`.
- assert.t( "Nested with list arguments",
- "#qunit-fixture div:has(faketag, div:has(faketag, div:not([id])))",
+ assert.selectInFixture( "Nested with list arguments",
+ "div:has(faketag, div:has(faketag, div:not([id])))",
[ "moretests", "t2037", "fx-test-group", "fx-queue" ] );
} );