Skip to content

Commit 9e74bce

Browse files
committed
Explain tests that were previously asserting invalid behaviors. (formatting)
1 parent 5307de8 commit 9e74bce

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

tests/phpunit/tests/formatting/wpAutop.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,15 @@ public function data_element_sanity() {
536536
"Hello <![CDATA[ <!-- a\nhttps://youtu.be/jgz0uSaOZbE\n a\n9 ]]> -->",
537537
"<p>Hello <![CDATA[ <!-- a\nhttps://youtu.be/jgz0uSaOZbE\n a\n9 ]]> --></p>\n",
538538
),
539+
/*
540+
* CDATA sections do not exist within HTML, so even though it looks
541+
* like this should be escaping the entire “inner comment” span, there’s
542+
* actually an invalid comment starting at `<![CDATA[` and ending at
543+
* the very first `>` character, placing the end of the comment at
544+
* what looks like the end of the “normal comment” — the ` -->`. Everything
545+
* afterward is normal HTML data so the `<br>` is a real `BR` element and
546+
* the `]]>` is normal plaintext, not the CDATA terminator.
547+
*/
539548
array(
540549
"Hello <![CDATA[ <!-- a\nhttps://youtu.be/jgz0uSaOZbE\n a\n9 --> a\n9 ]]>",
541550
"<p>Hello <![CDATA[ <!-- a\nhttps://youtu.be/jgz0uSaOZbE\n a\n9 --> a<br />\n9 ]]></p>\n",

tests/phpunit/tests/formatting/wpHtmlSplit.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ public function data_basic_features() {
3030
'abcd <!-- <html> --> efgh',
3131
array( 'abcd ', '<!-- <html> -->', ' efgh' ),
3232
),
33+
/*
34+
* CDATA sections do not exist within HTML, so even though it looks
35+
* like this should be escaping the entire ` <html> ` span, there’s
36+
* actually an invalid comment starting at `<![CDATA[` and ending at
37+
* the very first `>` character, placing the end of the comment at
38+
* the end of `html>`. The rest is normal plaintext content.
39+
*/
3340
array(
3441
'abcd <![CDATA[ <html> ]]> efgh',
3542
array( 'abcd ', '<![CDATA[ <html>', ' ]]> efgh' ),

0 commit comments

Comments
 (0)