@@ -65,7 +65,7 @@ jQuery.each( tests, function( strFlags, resultString ) {
65
65
66
66
test ( "jQuery.Callbacks( " + showFlags ( flags ) + " ) - " + filterLabel , function ( ) {
67
67
68
- expect ( 28 ) ;
68
+ expect ( 29 ) ;
69
69
70
70
var cblist ,
71
71
results = resultString . split ( / \s + / ) ;
@@ -94,7 +94,7 @@ jQuery.each( tests, function( strFlags, resultString ) {
94
94
strictEqual ( cblist . disabled ( ) , true , ".disabled() becomes true" ) ;
95
95
strictEqual ( cblist . locked ( ) , true , "disabling locks" ) ;
96
96
97
- // #13517 - Emptying while firing
97
+ // Emptying while firing (#13517)
98
98
cblist = jQuery . Callbacks ( flags ) ;
99
99
cblist . add ( cblist . empty ) ;
100
100
cblist . add ( function ( ) {
@@ -164,6 +164,16 @@ jQuery.each( tests, function( strFlags, resultString ) {
164
164
strictEqual ( output , "X" , "Lock early" ) ;
165
165
strictEqual ( cblist . locked ( ) , true , "Locking reflected in accessor" ) ;
166
166
167
+ // Locking while firing (gh-1990)
168
+ output = "X" ;
169
+ cblist = jQuery . Callbacks ( flags ) ;
170
+ cblist . add ( cblist . lock ) ;
171
+ cblist . add ( function ( str ) {
172
+ output += str ;
173
+ } ) ;
174
+ cblist . fire ( "A" ) ;
175
+ strictEqual ( output , "XA" , "Locking doesn't abort execution (gh-1990)" ) ;
176
+
167
177
// Ordering
168
178
output = "X" ;
169
179
cblist = jQuery . Callbacks ( flags ) ;
@@ -331,8 +341,6 @@ test( "jQuery.Callbacks.has", function() {
331
341
strictEqual ( cb . has ( ) , true , "Check if unique list has callback function(s) attached" ) ;
332
342
cb . lock ( ) ;
333
343
strictEqual ( cb . has ( ) , false , "locked() list is empty and returns false" ) ;
334
-
335
-
336
344
} ) ;
337
345
338
346
test ( "jQuery.Callbacks() - adding a string doesn't cause a stack overflow" , function ( ) {
0 commit comments