Skip to content

Commit 7537300

Browse files
committed
Add docblocks to tests, expand comments in class docblock.
1 parent 38cb836 commit 7537300

File tree

3 files changed

+92
-7
lines changed

3 files changed

+92
-7
lines changed

src/wp-includes/html-api/class-wp-html-processor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
* - Formatting elements: B, BIG, CODE, EM, FONT, I, SMALL, STRIKE, STRONG, TT, U.
106106
* - Heading elements: H1, H2, H3, H4, H5, H6, HGROUP.
107107
* - Links: A.
108-
* - Lists: DL.
108+
* - Lists: DD, DL, DT, LI, OL, LI.
109109
* - Media elements: AUDIO, CANVAS, FIGCAPTION, FIGURE, IMG, MAP, PICTURE, VIDEO.
110110
* - Paragraph: P.
111111
* - Phrasing elements: ABBR, BDI, BDO, CITE, DATA, DEL, DFN, INS, MARK, OUTPUT, Q, SAMP, SUB, SUP, TIME, VAR.

tests/phpunit/tests/html-api/wpHtmlProcessorSemanticRules.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public function test_in_body_button_with_button_in_scope_as_ancestor() {
227227
/**
228228
* Verifies that H1 through H6 elements close an open P element.
229229
*
230-
* @ticket {TICKET_NUMBER}
230+
* @ticket 60215
231231
*
232232
* @dataProvider data_heading_elements
233233
*
@@ -272,6 +272,8 @@ public function data_heading_elements() {
272272
/**
273273
* Verifies that H1 through H6 elements close an open H1 through H6 element.
274274
*
275+
* @ticket 60215
276+
*
275277
* @dataProvider data_heading_combinations
276278
*
277279
* @param string $first_heading H1 - H6 element appearing (unclosed) before the second.

tests/phpunit/tests/html-api/wpHtmlProcessorSemanticRulesListElements.php

+88-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* Unit tests covering WP_HTML_Processor compliance with HTML5 semantic parsing rules
4-
* for the LI list item element.
4+
* for the list elements, including DD, DL, DT, LI, OL, and UL.
55
*
66
* @package WordPress
77
* @subpackage HTML-API
@@ -16,6 +16,12 @@ class Tests_HtmlApi_WpHtmlProcessorSemanticRulesListElements extends WP_UnitTest
1616
/*******************************************************************
1717
* RULES FOR "IN BODY" MODE
1818
*******************************************************************/
19+
20+
/**
21+
* Ensures that an opening LI element implicitly closes an open LI element.
22+
*
23+
* @ticket 60215
24+
*/
1925
public function test_in_body_li_closes_open_li() {
2026
$processor = WP_HTML_Processor::create_fragment( '<li><li><li target>' );
2127

@@ -38,6 +44,11 @@ public function test_in_body_li_closes_open_li() {
3844
);
3945
}
4046

47+
/**
48+
* Ensures that an opening LI element implicitly closes other open elements with optional closing tags.
49+
*
50+
* @ticket 60215
51+
*/
4152
public function test_in_body_li_generates_implied_end_tags_inside_open_li() {
4253
$processor = WP_HTML_Processor::create_fragment( '<li><li><div><li target>' );
4354

@@ -60,6 +71,11 @@ public function test_in_body_li_generates_implied_end_tags_inside_open_li() {
6071
);
6172
}
6273

74+
/**
75+
* Ensures that when closing tags with optional tag closers, an opening LI tag doesn't close beyond a special boundary.
76+
*
77+
* @ticket 60215
78+
*/
6379
public function test_in_body_li_generates_implied_end_tags_inside_open_li_but_stopping_at_special_tags() {
6480
$processor = WP_HTML_Processor::create_fragment( '<li><li><blockquote><li target>' );
6581

@@ -82,6 +98,11 @@ public function test_in_body_li_generates_implied_end_tags_inside_open_li_but_st
8298
);
8399
}
84100

101+
/**
102+
* Ensures that an opening LI closes an open P in button scope.
103+
*
104+
* @ticket 60215
105+
*/
85106
public function test_in_body_li_in_li_closes_p_in_button_scope() {
86107
$processor = WP_HTML_Processor::create_fragment( '<li><li><p><button><p><li target>' );
87108

@@ -104,6 +125,13 @@ public function test_in_body_li_in_li_closes_p_in_button_scope() {
104125
);
105126
}
106127

128+
/**
129+
* Ensures that an opening DD closes an open DD element.
130+
*
131+
* Note that a DD closes an open DD and also an open DT.
132+
*
133+
* @ticket 60215
134+
*/
107135
public function test_in_body_dd_closes_open_dd() {
108136
$processor = WP_HTML_Processor::create_fragment( '<dd><dd><dd target>' );
109137

@@ -126,6 +154,13 @@ public function test_in_body_dd_closes_open_dd() {
126154
);
127155
}
128156

157+
/**
158+
* Ensures that an opening DD closes an open DT element.
159+
*
160+
* Note that a DD closes an open DD and also an open DT.
161+
*
162+
* @ticket 60215
163+
*/
129164
public function test_in_body_dd_closes_open_dt() {
130165
$processor = WP_HTML_Processor::create_fragment( '<dt><dt><dd target>' );
131166

@@ -148,7 +183,12 @@ public function test_in_body_dd_closes_open_dt() {
148183
);
149184
}
150185

151-
public function test_in_body_dd_generates_impdded_end_tags_inside_open_dd() {
186+
/**
187+
* Ensures that an opening DD implicitly closes open elements with optional closing tags.
188+
*
189+
* @ticket 60215
190+
*/
191+
public function test_in_body_dd_generates_implied_end_tags_inside_open_dd() {
152192
$processor = WP_HTML_Processor::create_fragment( '<dd><dd><div><dd target>' );
153193

154194
while (
@@ -170,7 +210,13 @@ public function test_in_body_dd_generates_impdded_end_tags_inside_open_dd() {
170210
);
171211
}
172212

173-
public function test_in_body_dd_generates_impdded_end_tags_inside_open_dd_but_stopping_at_special_tags() {
213+
/**
214+
* Ensures that an opening DD implicitly closes open elements with optional closing tags,
215+
* but doesn't close beyond a special boundary.
216+
*
217+
* @ticket 60215
218+
*/
219+
public function test_in_body_dd_generates_implied_end_tags_inside_open_dd_but_stopping_at_special_tags() {
174220
$processor = WP_HTML_Processor::create_fragment( '<dd><dd><blockquote><dd target>' );
175221

176222
while (
@@ -192,6 +238,11 @@ public function test_in_body_dd_generates_impdded_end_tags_inside_open_dd_but_st
192238
);
193239
}
194240

241+
/**
242+
* Ensures that an opening DD inside a DD closes a P in button scope.
243+
*
244+
* @ticket 60215
245+
*/
195246
public function test_in_body_dd_in_dd_closes_p_in_button_scope() {
196247
$processor = WP_HTML_Processor::create_fragment( '<dd><dd><p><button><p><dd target>' );
197248

@@ -214,6 +265,11 @@ public function test_in_body_dd_in_dd_closes_p_in_button_scope() {
214265
);
215266
}
216267

268+
/**
269+
* Ensures that an opening DT closes an open DT element.
270+
*
271+
* @ticket 60215
272+
*/
217273
public function test_in_body_dt_closes_open_dt() {
218274
$processor = WP_HTML_Processor::create_fragment( '<dt><dt><dt target>' );
219275

@@ -236,6 +292,11 @@ public function test_in_body_dt_closes_open_dt() {
236292
);
237293
}
238294

295+
/**
296+
* Ensures that an opening DT closes an open DD.
297+
*
298+
* @ticket 60215
299+
*/
239300
public function test_in_body_dt_closes_open_dd() {
240301
$processor = WP_HTML_Processor::create_fragment( '<dd><dd><dt target>' );
241302

@@ -258,7 +319,12 @@ public function test_in_body_dt_closes_open_dd() {
258319
);
259320
}
260321

261-
public function test_in_body_dt_generates_impdted_end_tags_inside_open_dt() {
322+
/**
323+
* Ensures that an opening DT implicitly closes open elements with optional closing tags.
324+
*
325+
* @ticket 60215
326+
*/
327+
public function test_in_body_dt_generates_implied_end_tags_inside_open_dt() {
262328
$processor = WP_HTML_Processor::create_fragment( '<dt><dt><div><dt target>' );
263329

264330
while (
@@ -280,7 +346,13 @@ public function test_in_body_dt_generates_impdted_end_tags_inside_open_dt() {
280346
);
281347
}
282348

283-
public function test_in_body_dt_generates_impdted_end_tags_inside_open_dt_but_stopping_at_special_tags() {
349+
/**
350+
* Ensures that an opening DT implicitly closes open elements with optional closing tags,
351+
* but doesn't close beyond a special boundary.
352+
*
353+
* @ticket 60215
354+
*/
355+
public function test_in_body_dt_generates_implied_end_tags_inside_open_dt_but_stopping_at_special_tags() {
284356
$processor = WP_HTML_Processor::create_fragment( '<dt><dt><blockquote><dt target>' );
285357

286358
while (
@@ -302,6 +374,11 @@ public function test_in_body_dt_generates_impdted_end_tags_inside_open_dt_but_st
302374
);
303375
}
304376

377+
/**
378+
* Ensures that an opening DT inside a DT closes a P in button scope.
379+
*
380+
* @ticket 60215
381+
*/
305382
public function test_in_body_dt_in_dt_closes_p_in_button_scope() {
306383
$processor = WP_HTML_Processor::create_fragment( '<dt><dt><p><button><p><dt target>' );
307384

@@ -324,6 +401,12 @@ public function test_in_body_dt_in_dt_closes_p_in_button_scope() {
324401
);
325402
}
326403

404+
/**
405+
* Ensures that an unexpected LI doesn't close more elements than it should, that it doesn't
406+
* close open LI elements that are beyond a special element (in this case, the UL).
407+
*
408+
* @ticket 60215
409+
*/
327410
public function test_unexpected_li_close_tag_is_properly_contained() {
328411
$processor = WP_HTML_Processor::create_fragment( '<ul><li><ul></li><li target>a</li></ul></li></ul>' );
329412

0 commit comments

Comments
 (0)