diff options
author | Devin Wilson <dwilson6.github@gmail.com> | 2016-01-13 21:06:43 -0700 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2016-01-15 13:50:02 -0500 |
commit | 5938a21466ef84213e41faf8a723844f639e00e3 (patch) | |
tree | 87e9447b9ac2e82ca3ca0063e836e1f3688db813 | |
parent | 8c293e62bb39cdf347bd045a1e89a54549f972eb (diff) | |
download | jquery-5938a21466ef84213e41faf8a723844f639e00e3.tar.gz jquery-5938a21466ef84213e41faf8a723844f639e00e3.zip |
Event: Add tests for chaining .on() with null handlers
Fixes gh-2812
Close gh-2825
-rw-r--r-- | test/unit/event.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test/unit/event.js b/test/unit/event.js index 14fcba0b3..762a9e1e9 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -6,7 +6,7 @@ QUnit.module( "event", { } ); QUnit.test( "null or undefined handler", function( assert ) { - assert.expect( 2 ); + assert.expect( 4 ); // Supports Fixes bug #7229 try { @@ -18,6 +18,13 @@ QUnit.test( "null or undefined handler", function( assert ) { jQuery( "#firstp" ).on( "click", undefined ); assert.ok( true, "Passing an undefined handler will not throw an exception" ); } catch ( e ) {} + + var expectedElem = jQuery( "#firstp" ); + var actualElem = expectedElem.on( "click", null ); + assert.equal(actualElem, expectedElem, "Passing a null handler should return the original element"); + + actualElem = expectedElem.on( "click", undefined ); + assert.equal(actualElem, expectedElem, "Passing a null handler should return the original element"); } ); QUnit.test( "on() with non-null,defined data", function( assert ) { |