aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/css.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/css.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/css.js')
-rw-r--r--test/unit/css.js9
1 files changed, 2 insertions, 7 deletions
diff --git a/test/unit/css.js b/test/unit/css.js
index b2b259433..2df877de8 100644
--- a/test/unit/css.js
+++ b/test/unit/css.js
@@ -1,4 +1,4 @@
-if ( jQuery.css ) {
+if ( includesModule( "css" ) ) {
QUnit.module( "css", { afterEach: moduleTeardown } );
@@ -487,9 +487,6 @@ QUnit.test( "css(Object) where values are Functions with incoming values", funct
jQuery( "#cssFunctionTest" ).remove();
} );
-// .show(), .hide(), can be excluded from the build
-if ( jQuery.fn.show && jQuery.fn.hide ) {
-
QUnit.test( "show()", function( assert ) {
assert.expect( 18 );
@@ -968,8 +965,6 @@ QUnit.test( "show/hide 3.0, inline hidden", function( assert ) {
} );
} );
-}
-
QUnit[ jQuery.find.compile && jQuery.fn.toggle ? "test" : "skip" ]( "toggle()", function( assert ) {
assert.expect( 9 );
var div, oldHide,
@@ -1194,7 +1189,7 @@ QUnit.test( "can't get background-position in IE<9, see trac-10796", function( a
}
} );
-if ( jQuery.fn.offset ) {
+if ( includesModule( "offset" ) ) {
QUnit.test( "percentage properties for left and top should be transformed to pixels, see trac-9505", function( assert ) {
assert.expect( 2 );
var parent = jQuery( "<div style='position:relative;width:200px;height:200px;margin:0;padding:0;border-width:0'></div>" ).appendTo( "#qunit-fixture" ),