Skip to content

Commit

Permalink
Improve some complex selector match tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Dec 5, 2024
1 parent 7bccf3e commit 3949cc5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/phpunit/tests/html-api/wpHtmlProcessor-select.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,18 @@ public function test_select_all( string $html, string $selector, int $match_coun
/**
* Data provider.
*
* Most selectors are covered by the tag processor selector tests.
* This suite should focus on complex selectors.
*
* @return array
*/
public static function data_selectors(): array {
return array(
'any descendant' => array( '<section><p match><i match><em match><p match>', 'section *', 4 ),
'any child 1' => array( '<section><p match><i><em><p match>', 'section > *', 2 ),
'any child 2' => array( '<div><section match><div>', 'div > *', 1 ),
'any' => array( '<html match><head match><meta match><body match><p match>', '*', 5 ),
'quirks mode ID' => array( '<p id="id" match><p id="ID" match>In quirks mode, ID matching is case-insensitive.', '#id', 2 ),
'quirks mode class' => array( '<p class="c" match><p class="C" match>In quirks mode, class matching is case-insensitive.', '.c', 2 ),
'no-quirks mode ID' => array( '<!DOCTYPE html><p id="id" match><p id="ID" match>In no-quirks mode, ID matching is case-sensitive.', '#id', 1 ),
'no-quirks mode class' => array( '<!DOCTYPE html><p class="c" match><p class="C">In no-quirks mode, class matching is case-sensitive.', '.c', 1 ),
'any descendant' => array( '<section><p match><i match><em match><p match>', 'section *', 4 ),
'any child 1' => array( '<section><p match><i><em><p match>', 'section > *', 2 ),
'any child 2' => array( '<div><section match><div>', 'div > *', 1 ),
);
}

Expand Down

0 comments on commit 3949cc5

Please sign in to comment.