@@ -116,69 +116,7 @@ public static function data_has_self_closing_flag() {
116116 'Self-closing flag after quoted attribute ' => array ( '<div id="test"/> ' , true ),
117117 'Self-closing flag after boolean attribute ' => array ( '<div enabled/> ' , true ),
118118 'Boolean attribute that looks like a self-closer ' => array ( '<div / > ' , false ),
119- );
120- }
121-
122- /**
123- * Ensures internally consumed special-element closers do not affect the opener's
124- * self-closing flag.
125- *
126- * @ticket 61576
127- *
128- * @covers WP_HTML_Tag_Processor::has_self_closing_flag
129- *
130- * @dataProvider data_special_atomic_self_closing_flags
131- *
132- * @param string $html Input HTML whose first tag might contain the self-closing flag `/`.
133- * @param bool $flag_is_set Whether the input HTML's first tag contains the self-closing flag.
134- */
135- public function test_special_atomic_elements_report_opening_tag_self_closing_flag ( string $ html , bool $ flag_is_set ) {
136- $ processor = new WP_HTML_Tag_Processor ( $ html );
137-
138- $ this ->assertTrue ( $ processor ->next_token (), 'Expected to find complete special atomic tag. ' );
139-
140- if ( $ flag_is_set ) {
141- $ this ->assertTrue ( $ processor ->has_self_closing_flag (), 'Did not find the self-closing flag on the opening tag. ' );
142- } else {
143- $ this ->assertFalse ( $ processor ->has_self_closing_flag (), 'Reported the internally consumed closing tag self-closing flag on the opening tag. ' );
144- }
145- }
146-
147- /**
148- * Data provider.
149- *
150- * @return array[]
151- */
152- public static function data_special_atomic_self_closing_flags () {
153- return array (
154- 'SCRIPT closer self-closing flag ' => array ( '<script>x</script/> ' , false ),
155- 'STYLE closer self-closing flag ' => array ( '<style>x</style/> ' , false ),
156- 'TITLE closer self-closing flag ' => array ( '<title>x</title/> ' , false ),
157- 'TITLE opener self-closing flag ' => array ( '<title/>x</title> ' , true ),
158- );
159- }
160-
161- /**
162- * Ensures a trailing slash in an unquoted attribute value is part of the value.
163- *
164- * @ticket 61576
165- *
166- * @covers WP_HTML_Tag_Processor::get_attribute
167- * @covers WP_HTML_Tag_Processor::has_self_closing_flag
168- */
169- public function test_trailing_slash_in_unquoted_attribute_value_is_not_self_closing_flag () {
170- $ processor = new WP_HTML_Tag_Processor ( '<mi disabled=abc/>text ' );
171- $ this ->assertTrue ( $ processor ->next_tag (), 'Could not find MI tag: check test setup. ' );
172-
173- $ this ->assertSame (
174- 'abc/ ' ,
175- $ processor ->get_attribute ( 'disabled ' ),
176- 'Trailing slash in unquoted attribute value should belong to the attribute value. '
177- );
178-
179- $ this ->assertFalse (
180- $ processor ->has_self_closing_flag (),
181- 'Trailing slash in unquoted attribute value should not be interpreted as a self-closing flag. '
119+ 'Self-closing flag on internally consumed special element closer ' => array ( '<title>x</title/> ' , false ),
182120 );
183121 }
184122
0 commit comments