diff --git a/tests/phpunit/tests/html-api/wpCssCompoundSelectorList.php b/tests/phpunit/tests/html-api/wpCssCompoundSelectorList.php
index 715e0e26bc9cd..6d1b142c17ea9 100644
--- a/tests/phpunit/tests/html-api/wpCssCompoundSelectorList.php
+++ b/tests/phpunit/tests/html-api/wpCssCompoundSelectorList.php
@@ -331,45 +331,53 @@ public function test_parse_attribute(
*/
public static function data_attribute_selectors(): array {
return array(
- '[href]' => array( '[href]', 'href', null, null, null, '' ),
- '[href] type' => array( '[href] type', 'href', null, null, null, ' type' ),
- '[href]#id' => array( '[href]#id', 'href', null, null, null, '#id' ),
- '[href].class' => array( '[href].class', 'href', null, null, null, '.class' ),
- '[href][href2]' => array( '[href][href2]', 'href', null, null, null, '[href2]' ),
- '[\n href\t\r]' => array( "[\n href\t\r]", 'href', null, null, null, '' ),
- '[href=foo]' => array( '[href=foo]', 'href', WP_CSS_Attribute_Selector::MATCH_EXACT, 'foo', null, '' ),
- '[href \n = bar ]' => array( "[href \n = bar ]", 'href', WP_CSS_Attribute_Selector::MATCH_EXACT, 'bar', null, '' ),
- '[href \n ^= baz ]' => array( "[href \n ^= baz ]", 'href', WP_CSS_Attribute_Selector::MATCH_PREFIXED_BY, 'baz', null, '' ),
-
- '[match $= insensitive i]' => array( '[match $= insensitive i]', 'match', WP_CSS_Attribute_Selector::MATCH_SUFFIXED_BY, 'insensitive', WP_CSS_Attribute_Selector::MODIFIER_CASE_INSENSITIVE, '' ),
- '[match|=sensitive s]' => array( '[match|=sensitive s]', 'match', WP_CSS_Attribute_Selector::MATCH_EXACT_OR_EXACT_WITH_HYPHEN, 'sensitive', WP_CSS_Attribute_Selector::MODIFIER_CASE_SENSITIVE, '' ),
- '[att=val I]' => array( '[att=val I]', 'att', WP_CSS_Attribute_Selector::MATCH_EXACT, 'val', WP_CSS_Attribute_Selector::MODIFIER_CASE_INSENSITIVE, '' ),
- '[att=val S]' => array( '[att=val S]', 'att', WP_CSS_Attribute_Selector::MATCH_EXACT, 'val', WP_CSS_Attribute_Selector::MODIFIER_CASE_SENSITIVE, '' ),
-
- '[match~="quoted[][]"]' => array( '[match~="quoted[][]"]', 'match', WP_CSS_Attribute_Selector::MATCH_ONE_OF_EXACT, 'quoted[][]', null, '' ),
- "[match$='quoted!{}']" => array( "[match$='quoted!{}']", 'match', WP_CSS_Attribute_Selector::MATCH_SUFFIXED_BY, 'quoted!{}', null, '' ),
- "[match*='quoted's]" => array( "[match*='quoted's]", 'match', WP_CSS_Attribute_Selector::MATCH_CONTAINS, 'quoted', WP_CSS_Attribute_Selector::MODIFIER_CASE_SENSITIVE, '' ),
-
- '[escape-nl="foo\\nbar"]' => array( "[escape-nl='foo\\\nbar']", 'escape-nl', WP_CSS_Attribute_Selector::MATCH_EXACT, 'foobar', null, '' ),
- '[escape-seq="\\31 23"]' => array( "[escape-seq='\\31 23']", 'escape-seq', WP_CSS_Attribute_Selector::MATCH_EXACT, '123', null, '' ),
+ '[href]' => array( '[href]', 'href', null, null, null, '' ),
+ '[href] type' => array( '[href] type', 'href', null, null, null, ' type' ),
+ '[href]#id' => array( '[href]#id', 'href', null, null, null, '#id' ),
+ '[href].class' => array( '[href].class', 'href', null, null, null, '.class' ),
+ '[href][href2]' => array( '[href][href2]', 'href', null, null, null, '[href2]' ),
+ '[\n href\t\r]' => array( "[\n href\t\r]", 'href', null, null, null, '' ),
+ '[href=foo]' => array( '[href=foo]', 'href', WP_CSS_Attribute_Selector::MATCH_EXACT, 'foo', null, '' ),
+ '[href \n = bar ]' => array( "[href \n = bar ]", 'href', WP_CSS_Attribute_Selector::MATCH_EXACT, 'bar', null, '' ),
+ '[href \n ^= baz ]' => array( "[href \n ^= baz ]", 'href', WP_CSS_Attribute_Selector::MATCH_PREFIXED_BY, 'baz', null, '' ),
+
+ '[match $= insensitive i]' => array( '[match $= insensitive i]', 'match', WP_CSS_Attribute_Selector::MATCH_SUFFIXED_BY, 'insensitive', WP_CSS_Attribute_Selector::MODIFIER_CASE_INSENSITIVE, '' ),
+ '[match|=sensitive s]' => array( '[match|=sensitive s]', 'match', WP_CSS_Attribute_Selector::MATCH_EXACT_OR_EXACT_WITH_HYPHEN, 'sensitive', WP_CSS_Attribute_Selector::MODIFIER_CASE_SENSITIVE, '' ),
+ '[att=val I]' => array( '[att=val I]', 'att', WP_CSS_Attribute_Selector::MATCH_EXACT, 'val', WP_CSS_Attribute_Selector::MODIFIER_CASE_INSENSITIVE, '' ),
+ '[att=val S]' => array( '[att=val S]', 'att', WP_CSS_Attribute_Selector::MATCH_EXACT, 'val', WP_CSS_Attribute_Selector::MODIFIER_CASE_SENSITIVE, '' ),
+
+ '[match~="quoted[][]"]' => array( '[match~="quoted[][]"]', 'match', WP_CSS_Attribute_Selector::MATCH_ONE_OF_EXACT, 'quoted[][]', null, '' ),
+ "[match$='quoted!{}']" => array( "[match$='quoted!{}']", 'match', WP_CSS_Attribute_Selector::MATCH_SUFFIXED_BY, 'quoted!{}', null, '' ),
+ "[match*='quoted's]" => array( "[match*='quoted's]", 'match', WP_CSS_Attribute_Selector::MATCH_CONTAINS, 'quoted', WP_CSS_Attribute_Selector::MODIFIER_CASE_SENSITIVE, '' ),
+
+ '[escape-nl="foo\\nbar"]' => array( "[escape-nl='foo\\\nbar']", 'escape-nl', WP_CSS_Attribute_Selector::MATCH_EXACT, 'foobar', null, '' ),
+ '[escape-seq="\\31 23"]' => array( "[escape-seq='\\31 23']", 'escape-seq', WP_CSS_Attribute_Selector::MATCH_EXACT, '123', null, '' ),
+
+ 'Unterminated: [att' => array( '[att', 'att', null, null, null, '' ),
+ 'Unterminated: [att="' => array( '[att="', 'att', WP_CSS_Attribute_Selector::MATCH_EXACT, '', null, '' ),
+ 'Unterminated: [att="\\"' => array( '[att="\\"', 'att', WP_CSS_Attribute_Selector::MATCH_EXACT, '"', null, '' ),
+ 'Unterminated: [att="x"' => array( '[att="x"', 'att', WP_CSS_Attribute_Selector::MATCH_EXACT, 'x', null, '' ),
+ 'Unterminated: [att="x\\"i]' => array( '[att="x\\"i]', 'att', WP_CSS_Attribute_Selector::MATCH_EXACT, 'x"i]', null, '' ),
+ 'Unterminated: [att="x" i' => array( '[att="x" i', 'att', WP_CSS_Attribute_Selector::MATCH_EXACT, 'x', WP_CSS_Attribute_Selector::MODIFIER_CASE_INSENSITIVE, '' ),
+ 'Unterminated: [att = x i' => array( '[att = x i', 'att', WP_CSS_Attribute_Selector::MATCH_EXACT, 'x', WP_CSS_Attribute_Selector::MODIFIER_CASE_INSENSITIVE, '' ),
// Invalid
- 'Invalid: (empty string)' => array( '' ),
- 'Invalid: foo' => array( 'foo' ),
- 'Invalid: [foo' => array( '[foo' ),
- 'Invalid: [#foo]' => array( '[#foo]' ),
- 'Invalid: [*|*]' => array( '[*|*]' ),
- 'Invalid: [ns|*]' => array( '[ns|*]' ),
- 'Invalid: [* |att]' => array( '[* |att]' ),
- 'Invalid: [*| att]' => array( '[*| att]' ),
- 'Invalid: [att * =]' => array( '[att * =]' ),
- 'Invalid: [att+=val]' => array( '[att+=val]' ),
- 'Invalid: [att=val ' => array( '[att=val ' ),
- 'Invalid: [att i]' => array( '[att i]' ),
- 'Invalid: [att s]' => array( '[att s]' ),
- "Invalid: [att='val\\n']" => array( "[att='val\n']" ),
- 'Invalid: [att=val i ' => array( '[att=val i ' ),
- 'Invalid: [att="val"ix' => array( '[att="val"ix' ),
+ 'Invalid: (empty string)' => array( '' ),
+ 'Invalid: foo' => array( 'foo' ),
+ 'Invalid: [foo' => array( '[foo' ),
+ 'Invalid: [#foo]' => array( '[#foo]' ),
+ 'Invalid: [*|*]' => array( '[*|*]' ),
+ 'Invalid: [ns|*]' => array( '[ns|*]' ),
+ 'Invalid: [* |att]' => array( '[* |att]' ),
+ 'Invalid: [*| att]' => array( '[*| att]' ),
+ 'Invalid: [att * =]' => array( '[att * =]' ),
+ 'Invalid: [att+=val]' => array( '[att+=val]' ),
+ 'Invalid: [att=val ' => array( '[att=val ' ),
+ 'Invalid: [att i]' => array( '[att i]' ),
+ 'Invalid: [att s]' => array( '[att s]' ),
+ "Invalid: [att='val\\n']" => array( "[att='val\n']" ),
+ 'Invalid: [att=val i ' => array( '[att=val i ' ),
+ 'Invalid: [att="val"ix' => array( '[att="val"ix' ),
);
}