@@ -39,16 +39,42 @@ public function test_select( string $html, string $selector ) {
3939 */
4040 public static function data_selectors (): array {
4141 return array (
42- 'simple type ' => array ( '<div match> ' , 'div ' ),
43- 'any type ' => array ( '<html match> ' , '* ' ),
44- 'simple class ' => array ( '<div class="x" match> ' , '.x ' ),
45- 'simple id ' => array ( '<div id="x" match> ' , '#x ' ),
46- 'simple attribute ' => array ( '<div att match> ' , '[att] ' ),
47- 'attribute value ' => array ( '<div att="val" match> ' , '[att=val] ' ),
48- 'attribute quoted value ' => array ( '<div att="::" match> ' , '[att="::"] ' ),
42+ 'simple type ' => array ( '<p><div match> ' , 'div ' ),
43+ 'any type ' => array ( '<div match> ' , '* ' ),
44+ 'simple class ' => array ( '<div><div class="x" match> ' , '.x ' ),
45+ 'simple id ' => array ( '<div><div id="x" match> ' , '#x ' ),
46+ 'boolean attribute ' => array ( '<div tta><div att match> ' , '[att] ' ),
47+ 'boolean attribute with string match ' => array ( '<div tta><div att match> ' , '[att=""] ' ),
4948
50- 'list ' => array ( '<div><p match> ' , 'a, p ' ),
51- 'compound ' => array ( '<div att><section att="foo bar" match> ' , 'section[att~="bar"] ' ),
49+ 'attribute value ' => array ( '<div att="v"><div att="val" match> ' , '[att=val] ' ),
50+ 'attribute quoted value ' => array ( '<div att><div att="::" match> ' , '[att="::"] ' ),
51+ 'attribute case insensitive ' => array ( '<div att="value"><div att="val" match> ' , '[att="VAL"i] ' ),
52+ 'attribute case sensitive mod ' => array ( '<div att="VAL"><div att="val" match> ' , '[att="val"s] ' ),
53+
54+ 'attribute one of ' => array ( '<div att="a B c"><div att="a b c" match> ' , '[att~="b"] ' ),
55+ 'attribute one of insensitive ' => array ( '<div att="a c"><div att="a B c" match> ' , '[att~="b"i] ' ),
56+ 'attribute one of mod sensitive ' => array ( '<div att="a B c"><div att="a b c" match> ' , '[att~="b"s] ' ),
57+ 'attribute one of whitespace cases ' => array ( "<div att=' a'><div att=' \na \ta b ' match> " , '[att~="b"] ' ),
58+
59+ 'attribute with-hyphen (no hyphen) ' => array ( '<p att="special_not"><p att="special" match> ' , '[att|="special"] ' ),
60+ 'attribute with-hyphen (hyphen prefix) ' => array ( '<p att="special_not"><p att="special-yeah" match> ' , '[att|="special"] ' ),
61+ 'attribute with-hyphen insensitive ' => array ( '<p att="special_not"><p att="SPECIAL" match> ' , '[att|="special"i] ' ),
62+ 'attribute with-hyphen sensitive mod ' => array ( '<p att="spec"><p att="special" match> ' , '[att|="special"s] ' ),
63+
64+ 'attribute prefixed ' => array ( '<p att="fix"><p att="prefix" match> ' , '[att^="p"] ' ),
65+ 'attribute prefixed insensitive ' => array ( '<p att="fix"><p att="Prefix" match> ' , '[att^="p"i] ' ),
66+ 'attribute prefixed sensitive mod ' => array ( '<p att="Prefix"><p att="prefix" match> ' , '[att^="p"s] ' ),
67+
68+ 'attribute suffixed ' => array ( '<p att="suffix_"><p att="suffix" match> ' , '[att$="x"] ' ),
69+ 'attribute suffixed insensitive ' => array ( '<p att="suffix_"><p att="suffiX" match> ' , '[att$="x"i] ' ),
70+ 'attribute suffixed sensitive mod ' => array ( '<p att="suffiX"><p att="suffix" match> ' , '[att$="x"s] ' ),
71+
72+ 'attribute contains ' => array ( '<p att="abcyz"><p att="abcxyz" match> ' , '[att*="x"] ' ),
73+ 'attribute contains insensitive ' => array ( '<p att="abcyz"><p att="abcXyz" match> ' , '[att*="x"i] ' ),
74+ 'attribute contains sensitive mod ' => array ( '<p att="abcXyz"><p att="abcxyz" match> ' , '[att*="x"s] ' ),
75+
76+ 'list ' => array ( '<div><p match> ' , 'a, p ' ),
77+ 'compound ' => array ( '<div att><section att="bar" match> ' , 'section[att="bar"] ' ),
5278 );
5379 }
5480
0 commit comments