mirror of
https://github.com/jquery/jquery.git
synced 2024-12-09 08:04:24 +00:00
Tests: Cleanup window
& document
handlers in a new event test
The "focusin on document & window" test didn't cleanup `focusout` handlers on `window` & `document`. This has been fixed. Ref gh-4657
This commit is contained in:
parent
46ba70c5e8
commit
c1c0598d8f
@ -2600,16 +2600,16 @@ QUnit.test( "focusin on document & window", function( assert ) {
|
||||
var counter = 0,
|
||||
input = jQuery( "<input />" );
|
||||
|
||||
function increment() {
|
||||
counter++;
|
||||
}
|
||||
|
||||
input.appendTo( "#qunit-fixture" );
|
||||
|
||||
input[ 0 ].focus();
|
||||
|
||||
jQuery( window ).on( "focusout", function() {
|
||||
counter++;
|
||||
} );
|
||||
jQuery( document ).on( "focusout", function() {
|
||||
counter++;
|
||||
} );
|
||||
jQuery( window ).on( "focusout", increment );
|
||||
jQuery( document ).on( "focusout", increment );
|
||||
|
||||
input[ 0 ].blur();
|
||||
|
||||
@ -2620,6 +2620,9 @@ QUnit.test( "focusin on document & window", function( assert ) {
|
||||
|
||||
assert.strictEqual( counter, 2,
|
||||
"focusout handlers on document/window fired once only" );
|
||||
|
||||
jQuery( window ).off( "focusout", increment );
|
||||
jQuery( document ).off( "focusout", increment );
|
||||
} );
|
||||
|
||||
testIframe(
|
||||
|
Loading…
Reference in New Issue
Block a user