aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/manipulation.js
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2022-07-12 17:12:27 +0200
committerGitHub <noreply@github.com>2022-07-12 17:12:27 +0200
commitbc16512879bd81de9874bffa690404e14e8f43ff (patch)
treed6bda9401d77c87014b8d7574e56468541125cee /test/unit/manipulation.js
parent0f6c3d9efc5f7e844bdcf8ef44f9327f414bea77 (diff)
downloadjquery-bc16512879bd81de9874bffa690404e14e8f43ff.tar.gz
jquery-bc16512879bd81de9874bffa690404e14e8f43ff.zip
Tests: Exclude tests based on compilation flags, not API presence (3.x version)
Introduces a new test API, `includesModule`. The method returns whether a particular module like "ajax" or "deprecated" is included in the current jQuery build; it handles the slim build as well. The util was created so that we don't treat presence of particular APIs to decide whether to run a test as then if we accidentally remove an API, the tests would still not fail. Closes gh-5071 Fixes gh-5069 Ref gh-5046 (partially cherry picked from commit fae5fee8b435cc20352d28b0a384b9784b1ad9ed)
Diffstat (limited to 'test/unit/manipulation.js')
-rw-r--r--test/unit/manipulation.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js
index 1535f0240..348912e6e 100644
--- a/test/unit/manipulation.js
+++ b/test/unit/manipulation.js
@@ -445,7 +445,7 @@ QUnit.test( "append HTML5 sectioning elements (Bug trac-6485)", function( assert
assert.equal( aside.length, 1, "HTML5 elements do not collapse their children" );
} );
-if ( jQuery.css ) {
+if ( includesModule( "css" ) ) {
QUnit.test( "HTML5 Elements inherit styles from style rules (Bug trac-10501)", function( assert ) {
assert.expect( 1 );
@@ -2344,7 +2344,7 @@ testIframe(
},
// The AJAX module is needed for jQuery._evalUrl.
- QUnit[ jQuery.ajax ? "test" : "skip" ]
+ QUnit[ includesModule( "ajax" ) ? "test" : "skip" ]
);
QUnit.test( "jQuery.clone - no exceptions for object elements trac-9587", function( assert ) {
@@ -2464,7 +2464,7 @@ QUnit.test( "html() - script exceptions bubble (trac-11743)", function( assert )
window.onerror = function() {
assert.ok( true, "Exception thrown" );
- if ( jQuery.ajax ) {
+ if ( includesModule( "ajax" ) ) {
window.onerror = function() {
assert.ok( true, "Exception thrown in remote script" );
};
@@ -2552,7 +2552,7 @@ QUnit.test( "script evaluation (trac-11795)", function( assert ) {
assert.deepEqual( fixture.children( "script" ).get(), scriptsOut.get(), "Scripts detached without reevaluation" );
objGlobal.ok = isOk;
- if ( jQuery.ajax ) {
+ if ( includesModule( "ajax" ) ) {
Globals.register( "testBar" );
jQuery( "#qunit-fixture" ).append( "<script src='" + url( "mock.php?action=testbar" ) + "'></script>" );
assert.strictEqual( window.testBar, "bar", "Global script evaluation" );
@@ -2562,7 +2562,7 @@ QUnit.test( "script evaluation (trac-11795)", function( assert ) {
}
} );
-QUnit[ jQuery.ajax ? "test" : "skip" ]( "jQuery._evalUrl (trac-12838)", function( assert ) {
+QUnit[ includesModule( "ajax" ) ? "test" : "skip" ]( "jQuery._evalUrl (trac-12838)", function( assert ) {
assert.expect( 5 );
@@ -2853,7 +2853,7 @@ QUnit.test( "Make sure tags with single-character names are found (gh-4124)", fu
} );
// The AJAX module is needed for jQuery._evalUrl.
-QUnit[ jQuery.ajax ? "test" : "skip" ]( "Insert script with data-URI (gh-1887)", function( assert ) {
+QUnit[ includesModule( "ajax" ) ? "test" : "skip" ]( "Insert script with data-URI (gh-1887)", function( assert ) {
assert.expect( 1 );
Globals.register( "testFoo" );
Globals.register( "testSrcFoo" );
@@ -2943,7 +2943,7 @@ testIframe(
// Old iOS & Android Browser versions support script-src but not nonce, making this test
// impossible to run. Browsers not supporting CSP at all are not a problem as they'll skip
// script-src restrictions completely.
- QUnit[ jQuery.ajax && !/\bedge\/|iphone os [789]|android 4\./i.test( navigator.userAgent ) ? "test" : "skip" ]
+ QUnit[ includesModule( "ajax" ) && !/\bedge\/|iphone os [789]|android 4\./i.test( navigator.userAgent ) ? "test" : "skip" ]
);
testIframe(