Skip to content

Commit

Permalink
Tests: Port changes from Sizzle
Browse files Browse the repository at this point in the history
  • Loading branch information
gibson042 committed Aug 20, 2019
1 parent df6a7f7 commit ac5f7cd
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions test/unit/selector.js
Expand Up @@ -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']" );
} );
Expand Down Expand Up @@ -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" );
Expand All @@ -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&#39;]'/>" +
"<input type='hidden' id='attrbad_quote' data-attr='&#39;'/>" +
"<input type='hidden' id='attrbad_backslash' data-attr='&#92;'/>" +
Expand All @@ -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" );
Expand Down

0 comments on commit ac5f7cd

Please sign in to comment.