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 21:24:35 -0500 |
commit | f5a8c649b54e8b7fde6253bd56972347f9bbe012 (patch) | |
tree | 18816aa52316aee3d6bf1ec2ce6f950ad26a5645 /test/unit/callbacks.js | |
parent | 6f0db5319d71261d47157c0a9ac0a2749a7b3311 (diff) | |
download | jquery-f5a8c649b54e8b7fde6253bd56972347f9bbe012.tar.gz jquery-f5a8c649b54e8b7fde6253bd56972347f9bbe012.zip |
Callbacks: No object starts out locked
Fixes gh-1989
Diffstat (limited to 'test/unit/callbacks.js')
-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"; |