diff options
author | Richard Gibson <richard.gibson@gmail.com> | 2015-01-02 09:42:06 -0500 |
---|---|---|
committer | Richard Gibson <richard.gibson@gmail.com> | 2015-01-10 23:04:34 -0500 |
commit | 0d829f0e9a177038580a59d0b5649fab76b8104f (patch) | |
tree | daea8986cf3a26522a273fa818e163af2c29dd8d /test | |
parent | 0c9d018889944da3d60cac135dc38dfcc37ac14a (diff) | |
download | jquery-0d829f0e9a177038580a59d0b5649fab76b8104f.tar.gz jquery-0d829f0e9a177038580a59d0b5649fab76b8104f.zip |
Callbacks: No object starts out locked
Fixes gh-1989
(cherry picked from commit f5a8c649b54e8b7fde6253bd56972347f9bbe012)
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/callbacks.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/test/unit/callbacks.js b/test/unit/callbacks.js index d997a0d9e..1984e578d 100644 --- a/test/unit/callbacks.js +++ b/test/unit/callbacks.js @@ -65,11 +65,7 @@ jQuery.each( tests, function( strFlags, resultString ) { test( "jQuery.Callbacks( " + showFlags( flags ) + " ) - " + filterLabel, function() { - expect( 21 ); - - // Give qunit a little breathing room - stop(); - setTimeout( start, 0 ); + expect( 28 ); var cblist, results = resultString.split( /\s+/ ); @@ -77,10 +73,14 @@ jQuery.each( tests, function( strFlags, resultString ) { // Basic binding and firing output = "X"; cblist = jQuery.Callbacks( flags ); + strictEqual( cblist.locked(), false, ".locked() initially false" ); + strictEqual( cblist.disabled(), false, ".disabled() initially false" ); + strictEqual( cblist.fired(), false, ".fired() initially false" ); cblist.add(function( str ) { output += str; }); - cblist.fire("A"); + strictEqual( cblist.fired(), false, ".fired() still false after .add" ); + cblist.fire( "A" ); strictEqual( output, "XA", "Basic binding and firing" ); strictEqual( cblist.fired(), true, ".fired() detects firing" ); output = "X"; @@ -91,6 +91,8 @@ jQuery.each( tests, function( strFlags, resultString ) { strictEqual( output, "X", "Adding a callback after disabling" ); cblist.fire("A"); strictEqual( output, "X", "Firing after disabling" ); + strictEqual( cblist.disabled(), true, ".disabled() becomes true" ); + strictEqual( cblist.locked(), true, "disabling locks" ); // #13517 - Emptying while firing cblist = jQuery.Callbacks( flags ); @@ -160,6 +162,7 @@ jQuery.each( tests, function( strFlags, resultString ) { output += str; }); strictEqual( output, "X", "Lock early" ); + strictEqual( cblist.locked(), true, "Locking reflected in accessor" ); // Ordering output = "X"; |