+ The antics of ants with antlers
+
+
+ Ants
+ with antlers can be funny.
+
+
+ - Decorations
+ - Cleanup crew
+ - Spooky visitors
+
+
+
+HTML;
+
+ list( $selectors ) = WP_HTML_Attribute_Sourcer::parse_selector( $selector );
+ $this->assertIsArray( $selectors );
+
+ $found_ids = array();
+ if ( $tags = WP_HTML_Attribute_Sourcer::select( [ $selectors ], $html ) ) {
+ $found_ids[] = $tags->get_attribute( 'id' );
+ }
+
+ $this->assertEqualsCanonicalizing( $wanted_ids, $found_ids );
+ }
+
+ public function data_ids_and_their_selectors() {
+ return array(
+ array( array( 'li-1' ), 'li' ),
+ array( array(), 'section > p img + em' ),
+ array( array( 'strong-ants' ), 'section > p img + strong' ),
+ array( array( 'funny-stuff' ), 'section > p strong + em' ),
+ array( array( 'page-title' ), 'section h2' ),
+ array( array( 'post-title' ), 'section > h2' ),
+ array( array( 'ant-logo' ), '[href]' ),
+ array( array(), '.non-existent' ),
+ );
+ }
+
/**
* @dataProvider data_single_combinators
*/