<{$first_heading} first> then <{$second_heading} second> and end {$second_heading}>
{$first_heading}>
"
+ );
+
+ while ( $processor->next_tag() && null === $processor->get_attribute( 'second' ) ) {
+ continue;
+ }
+
+ $this->assertTrue(
+ $processor->get_attribute( 'second' ),
+ "Failed to find expected {$second_heading} tag."
+ );
+
+ $this->assertSame(
+ array( 'HTML', 'BODY', 'DIV', $second_heading ),
+ $processor->get_breadcrumbs(),
+ "Expected {$second_heading} to be a direct child of the DIV, having closed the open {$first_heading} element."
+ );
+
+ $processor->next_tag( 'IMG' );
+ $this->assertSame(
+ array( 'HTML', 'BODY', 'DIV', 'IMG' ),
+ $processor->get_breadcrumbs(),
+ "Expected IMG to be a direct child of DIV, having closed the open {$first_heading} element."
+ );
+ }
+
+ /**
+ * Data provider.
+ *
+ * @return array[]
+ */
+ public function data_heading_combinations() {
+ $headings = array( 'H1', 'H2', 'H3', 'H4', 'H5', 'H6' );
+
+ $combinations = array();
+
+ // Create all unique pairs of H1 - H6 elements.
+ foreach ( $headings as $first_tag ) {
+ foreach ( $headings as $second_tag ) {
+ $combinations[ "{$first_tag} then {$second_tag}" ] = array( $first_tag, $second_tag );
+ }
+ }
+
+ return $combinations;
+ }
+
/**
* Verifies that when "in body" and encountering "any other end tag"
* that the HTML processor ignores the end tag if there's a special
diff --git a/tests/phpunit/tests/html-api/wpHtmlSupportRequiredHtmlProcessor.php b/tests/phpunit/tests/html-api/wpHtmlSupportRequiredHtmlProcessor.php
index b0951b580ce26..2770acb7360df 100644
--- a/tests/phpunit/tests/html-api/wpHtmlSupportRequiredHtmlProcessor.php
+++ b/tests/phpunit/tests/html-api/wpHtmlSupportRequiredHtmlProcessor.php
@@ -58,9 +58,6 @@ private function ensure_support_is_added_everywhere( $tag_name ) {
* @covers WP_HTML_Processor::generate_implied_end_tags
*/
public function test_generate_implied_end_tags_needs_support() {
- $this->ensure_support_is_added_everywhere( 'DD' );
- $this->ensure_support_is_added_everywhere( 'DT' );
- $this->ensure_support_is_added_everywhere( 'LI' );
$this->ensure_support_is_added_everywhere( 'OPTGROUP' );
$this->ensure_support_is_added_everywhere( 'OPTION' );
$this->ensure_support_is_added_everywhere( 'RB' );
@@ -82,9 +79,6 @@ public function test_generate_implied_end_tags_needs_support() {
public function test_generate_implied_end_tags_thoroughly_needs_support() {
$this->ensure_support_is_added_everywhere( 'CAPTION' );
$this->ensure_support_is_added_everywhere( 'COLGROUP' );
- $this->ensure_support_is_added_everywhere( 'DD' );
- $this->ensure_support_is_added_everywhere( 'DT' );
- $this->ensure_support_is_added_everywhere( 'LI' );
$this->ensure_support_is_added_everywhere( 'OPTGROUP' );
$this->ensure_support_is_added_everywhere( 'OPTION' );
$this->ensure_support_is_added_everywhere( 'RB' );
diff --git a/tests/phpunit/tests/html-api/wpHtmlSupportRequiredOpenElements.php b/tests/phpunit/tests/html-api/wpHtmlSupportRequiredOpenElements.php
index 9dbb689df0329..adbe84c9b1314 100644
--- a/tests/phpunit/tests/html-api/wpHtmlSupportRequiredOpenElements.php
+++ b/tests/phpunit/tests/html-api/wpHtmlSupportRequiredOpenElements.php
@@ -130,13 +130,6 @@ public function test_has_element_in_list_item_scope_needs_support() {
$this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
$this->ensure_support_is_added_everywhere( 'DESC' );
$this->ensure_support_is_added_everywhere( 'TITLE' );
-
- // These elements are specific to list item scope.
- $this->ensure_support_is_added_everywhere( 'OL' );
- $this->ensure_support_is_added_everywhere( 'UL' );
-
- // This element is the only element that depends on list item scope.
- $this->ensure_support_is_added_everywhere( 'LI' );
}
/**