Skip to content

Commit 5938a21

Browse files
dwilson6timmywil
authored andcommitted
Event: Add tests for chaining .on() with null handlers
Fixes jquerygh-2812 Close jquerygh-2825
1 parent 8c293e6 commit 5938a21

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/unit/event.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ QUnit.module( "event", {
66
} );
77

88
QUnit.test( "null or undefined handler", function( assert ) {
9-
assert.expect( 2 );
9+
assert.expect( 4 );
1010

1111
// Supports Fixes bug #7229
1212
try {
@@ -18,6 +18,13 @@ QUnit.test( "null or undefined handler", function( assert ) {
1818
jQuery( "#firstp" ).on( "click", undefined );
1919
assert.ok( true, "Passing an undefined handler will not throw an exception" );
2020
} catch ( e ) {}
21+
22+
var expectedElem = jQuery( "#firstp" );
23+
var actualElem = expectedElem.on( "click", null );
24+
assert.equal(actualElem, expectedElem, "Passing a null handler should return the original element");
25+
26+
actualElem = expectedElem.on( "click", undefined );
27+
assert.equal(actualElem, expectedElem, "Passing a null handler should return the original element");
2128
} );
2229

2330
QUnit.test( "on() with non-null,defined data", function( assert ) {

0 commit comments

Comments
 (0)