diff options
author | Richard Gibson <richard.gibson@gmail.com> | 2019-08-20 14:05:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-20 14:05:37 -0400 |
commit | ac5f7cd8e29ecc7cdf21c13199be5472375ffa0e (patch) | |
tree | 0e1e2a92a655cb6e0b30604f55918cfea6255532 /test/unit | |
parent | df6a7f7f0f615149266b1a51064293b748b29900 (diff) | |
download | jquery-ac5f7cd8e29ecc7cdf21c13199be5472375ffa0e.tar.gz jquery-ac5f7cd8e29ecc7cdf21c13199be5472375ffa0e.zip |
Tests: Port changes from Sizzle
Ref https://github.com/jquery/sizzle/pull/450
Closes gh-4464
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/selector.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/test/unit/selector.js b/test/unit/selector.js index 2c17b8682..779b554e7 100644 --- a/test/unit/selector.js +++ b/test/unit/selector.js @@ -221,8 +221,8 @@ QUnit.test( "broken selectors throw", function( assert ) { .appendTo( "#qunit-fixture" ); broken( "Attribute equals non-value", "input[name=]" ); - broken( "Attribute equals unquoted non-identifer", "input[name=foo.baz]" ); - broken( "Attribute equals unquoted non-identifer", "input[name=foo[baz]]" ); + broken( "Attribute equals unquoted non-identifier", "input[name=foo.baz]" ); + broken( "Attribute equals unquoted non-identifier", "input[name=foo[baz]]" ); broken( "Attribute equals bad string", "input[name=''double-quoted'']" ); broken( "Attribute equals bad string", "input[name='apostrophe'd']" ); } ); @@ -638,7 +638,7 @@ QUnit.test( "attributes - hyphen-prefix matches", function( assert ) { } ); QUnit.test( "attributes - special characters", function( assert ) { - assert.expect( 14 ); + assert.expect( 16 ); var attrbad; var div = document.createElement( "div" ); @@ -656,6 +656,7 @@ QUnit.test( "attributes - special characters", function( assert ) { "<input type='hidden' id='attrbad_space' name='foo bar'/>" + "<input type='hidden' id='attrbad_dot' value='2' name='foo.baz'/>" + "<input type='hidden' id='attrbad_brackets' value='2' name='foo[baz]'/>" + + "<input type='hidden' id='attrbad_leading_digits' name='agent' value='007'/>" + "<input type='hidden' id='attrbad_injection' data-attr='foo_baz']'/>" + "<input type='hidden' id='attrbad_quote' data-attr='''/>" + "<input type='hidden' id='attrbad_backslash' data-attr='\'/>" + @@ -678,6 +679,13 @@ QUnit.test( "attributes - special characters", function( assert ) { q( "attrbad_injection" ), "string containing quote and right bracket" ); + assert.deepEqual( jQuery.find( "input[value=\\30 \\30\\37 ]", null, null, attrbad ), + q( "attrbad_leading_digits" ), + "identifier containing escaped leading digits with whitespace termination" ); + assert.deepEqual( jQuery.find( "input[value=\\00003007]", null, null, attrbad ), + q( "attrbad_leading_digits" ), + "identifier containing escaped leading digits without whitespace termination" ); + assert.deepEqual( jQuery.find( "input[data-attr='\\'']", null, null, attrbad ), q( "attrbad_quote" ), "string containing quote" ); |