aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/queue.js
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2022-06-28 12:39:01 +0200
committerGitHub <noreply@github.com>2022-06-28 12:39:01 +0200
commitfae5fee8b435cc20352d28b0a384b9784b1ad9ed (patch)
tree86ae9425c469a476c25ce62399297d35472dbc2c /test/unit/queue.js
parent52f452b2e8881e5ec5c9e880e277c8ecf633e8dc (diff)
downloadjquery-fae5fee8b435cc20352d28b0a384b9784b1ad9ed.tar.gz
jquery-fae5fee8b435cc20352d28b0a384b9784b1ad9ed.zip
Tests: Exclude tests based on compilation flags, not API presence
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. Fixes gh-5069 Closes gh-5046
Diffstat (limited to 'test/unit/queue.js')
-rw-r--r--test/unit/queue.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/unit/queue.js b/test/unit/queue.js
index 7e124210b..312b37b8c 100644
--- a/test/unit/queue.js
+++ b/test/unit/queue.js
@@ -2,7 +2,7 @@ QUnit.module( "queue", { afterEach: moduleTeardown } );
( function() {
-if ( !jQuery.fn.queue ) {
+if ( !includesModule( "queue" ) ) {
return;
}
@@ -241,7 +241,7 @@ QUnit.test( "fn.promise( \"queue\" ) - called whenever last queue function is de
foo.dequeue( "queue" );
} );
-if ( jQuery.fn.animate ) {
+if ( includesModule( "effects" ) ) {
QUnit.test( "fn.promise( \"queue\" ) - waits for animation to complete before resolving", function( assert ) {
assert.expect( 2 );
@@ -277,7 +277,7 @@ QUnit.test( ".promise(obj)", function( assert ) {
assert.strictEqual( promise, obj, ".promise(type, obj) returns obj" );
} );
-QUnit[ jQuery.fn.stop ? "test" : "skip" ]( "delay() can be stopped", function( assert ) {
+QUnit[ includesModule( "effects" ) ? "test" : "skip" ]( "delay() can be stopped", function( assert ) {
var done = assert.async();
assert.expect( 3 );
var storage = {};
@@ -314,7 +314,7 @@ QUnit[ jQuery.fn.stop ? "test" : "skip" ]( "delay() can be stopped", function( a
}, 1500 );
} );
-QUnit[ jQuery.fn.stop ? "test" : "skip" ]( "queue stop hooks", function( assert ) {
+QUnit[ includesModule( "effects" ) ? "test" : "skip" ]( "queue stop hooks", function( assert ) {
assert.expect( 2 );
var done = assert.async();
var foo = jQuery( "#foo" );