aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2016-05-06 22:12:53 -0400
committerRichard Gibson <richard.gibson@gmail.com>2016-05-06 22:12:53 -0400
commite8825a529b97a27b8b2e40eaaa7773189642c772 (patch)
treecd1e74d0024fb208a5d2fe371cf6074407320179 /test
parent7fd36ea145a11d5896de6d064b546b1c57a83f34 (diff)
downloadjquery-e8825a529b97a27b8b2e40eaaa7773189642c772.tar.gz
jquery-e8825a529b97a27b8b2e40eaaa7773189642c772.zip
Event: Cover invalid delegation selector edge cases
Ref 7fd36ea145a11d5896de6d064b546b1c57a83f34
Diffstat (limited to 'test')
-rw-r--r--test/unit/event.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/test/unit/event.js b/test/unit/event.js
index 6b4af04b9..5d4108c90 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -1289,17 +1289,19 @@ QUnit.test( "Delegated events in SVG (#10791; #13180)", function( assert ) {
jQuery( "#qunit-fixture" ).off( "click" );
} );
-QUnit.test( "Delegated events with malformed selectors (#3071)", function( assert ) {
- assert.expect( 2 );
+QUnit.test( "Delegated events with malformed selectors (gh-3071)", function( assert ) {
+ assert.expect( 3 );
- assert.throws( function () {
- jQuery( "#qunit-fixture" ).on( "click", "div:not", function () { } );
- }, null, "malformed selector throws on attach" );
+ assert.throws( function() {
+ jQuery( "#foo" ).on( "click", ":not", function() {} );
+ }, "malformed selector throws on attach" );
- jQuery( "#qunit-fixture" ).click();
- assert.ok( true, "malformed selector does not throw on event" );
+ assert.throws( function() {
+ jQuery( "#foo" ).on( "click", "nonexistent:not", function() {} );
+ }, "short-circuitable malformed selector throws on attach" );
- jQuery( "#qunit-fixture" ).off( "click" );
+ jQuery( "#foo > :first-child" ).click();
+ assert.ok( true, "malformed selector does not throw on event" );
} );
QUnit.test( "Delegated events in forms (#10844; #11145; #8165; #11382, #11764)", function( assert ) {