aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/queue.js
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2019-05-13 21:39:56 +0200
committerGitHub <noreply@github.com>2019-05-13 21:39:56 +0200
commit3527a3840585e6a359cd712591c9c57398357b9b (patch)
tree41446f392d9a8984e31297df3252d1b538f4191e /test/unit/queue.js
parentccbd6b93424cbdbf86f07a86c2e55cbab497d7a3 (diff)
downloadjquery-3527a3840585e6a359cd712591c9c57398357b9b.tar.gz
jquery-3527a3840585e6a359cd712591c9c57398357b9b.zip
Core: Remove IE-specific support tests, rely on document.documentMode
Also, update some tests to IE-sniff when deciding whether to skip a test. Fixes gh-4386 Closes gh-4387
Diffstat (limited to 'test/unit/queue.js')
-rw-r--r--test/unit/queue.js105
1 files changed, 51 insertions, 54 deletions
diff --git a/test/unit/queue.js b/test/unit/queue.js
index 6c8ad762d..df7eaf4ca 100644
--- a/test/unit/queue.js
+++ b/test/unit/queue.js
@@ -271,64 +271,61 @@ QUnit.test( ".promise(obj)", function( assert ) {
assert.strictEqual( promise, obj, ".promise(type, obj) returns obj" );
} );
-if ( jQuery.fn.stop ) {
- QUnit.test( "delay() can be stopped", function( assert ) {
- var done = assert.async();
- assert.expect( 3 );
- var storage = {};
- jQuery( {} )
- .queue( "alternate", function( next ) {
- storage.alt1 = true;
- assert.ok( true, "This first function was dequeued" );
- next();
- } )
- .delay( 1000, "alternate" )
- .queue( "alternate", function() {
- storage.alt2 = true;
- assert.ok( true, "The function was dequeued immediately, the delay was stopped" );
- } )
- .dequeue( "alternate" )
-
- // stop( "alternate", false ) will NOT clear the queue, so it should automatically dequeue the next
- .stop( "alternate", false, false )
-
- // this test
- .delay( 1 )
- .queue( function() {
- storage.default1 = true;
- assert.ok( false, "This queue should never run" );
- } )
-
- // stop( clearQueue ) should clear the queue
- .stop( true, false );
-
- assert.deepEqual( storage, { alt1: true, alt2: true }, "Queue ran the proper functions" );
+QUnit[ jQuery.fn.stop ? "test" : "skip" ]( "delay() can be stopped", function( assert ) {
+ var done = assert.async();
+ assert.expect( 3 );
+ var storage = {};
+ jQuery( {} )
+ .queue( "alternate", function( next ) {
+ storage.alt1 = true;
+ assert.ok( true, "This first function was dequeued" );
+ next();
+ } )
+ .delay( 1000, "alternate" )
+ .queue( "alternate", function() {
+ storage.alt2 = true;
+ assert.ok( true, "The function was dequeued immediately, the delay was stopped" );
+ } )
+ .dequeue( "alternate" )
- setTimeout( function() {
- done();
- }, 1500 );
- } );
+ // stop( "alternate", false ) will NOT clear the queue, so it should automatically dequeue the next
+ .stop( "alternate", false, false )
- QUnit.test( "queue stop hooks", function( assert ) {
- assert.expect( 2 );
- var done = assert.async();
- var foo = jQuery( "#foo" );
+ // this test
+ .delay( 1 )
+ .queue( function() {
+ storage.default1 = true;
+ assert.ok( false, "This queue should never run" );
+ } )
- foo.queue( function( next, hooks ) {
- hooks.stop = function( gotoEnd ) {
- assert.equal( !!gotoEnd, false, "Stopped without gotoEnd" );
- };
- } );
- foo.stop();
+ // stop( clearQueue ) should clear the queue
+ .stop( true, false );
- foo.queue( function( next, hooks ) {
- hooks.stop = function( gotoEnd ) {
- assert.equal( gotoEnd, true, "Stopped with gotoEnd" );
- done();
- };
- } );
+ assert.deepEqual( storage, { alt1: true, alt2: true }, "Queue ran the proper functions" );
- foo.stop( false, true );
+ setTimeout( function() {
+ done();
+ }, 1500 );
+} );
+
+QUnit[ jQuery.fn.stop ? "test" : "skip" ]( "queue stop hooks", function( assert ) {
+ assert.expect( 2 );
+ var done = assert.async();
+ var foo = jQuery( "#foo" );
+
+ foo.queue( function( next, hooks ) {
+ hooks.stop = function( gotoEnd ) {
+ assert.equal( !!gotoEnd, false, "Stopped without gotoEnd" );
+ };
} );
+ foo.stop();
-} // if ( jQuery.fn.stop )
+ foo.queue( function( next, hooks ) {
+ hooks.stop = function( gotoEnd ) {
+ assert.equal( gotoEnd, true, "Stopped with gotoEnd" );
+ done();
+ };
+ } );
+
+ foo.stop( false, true );
+} );