mirror of
https://github.com/jquery/jquery.git
synced 2026-02-01 13:14:59 -05:00
Callbacks: Disabling a callback should prevent firing
Thanks to @TheDistantSea for the report! Fixes gh-1790 Closes gh-1643
This commit is contained in:
@@ -340,3 +340,18 @@ test( "jQuery.Callbacks() - adding a string doesn't cause a stack overflow", fun
|
||||
|
||||
ok( true, "no stack overflow" );
|
||||
});
|
||||
|
||||
test( "jQuery.Callbacks() - disabled callback doesn't fire (gh-1790)", function() {
|
||||
|
||||
expect( 1 );
|
||||
|
||||
var cb = jQuery.Callbacks(),
|
||||
fired = false,
|
||||
shot = function() { fired = true; };
|
||||
|
||||
cb.disable();
|
||||
cb.empty();
|
||||
cb.add( shot );
|
||||
cb.fire();
|
||||
ok( !fired, "Disabled callback function didn't fire" );
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user