Skip to content

Commit 43db05f

Browse files
committed
Add more test cases with non-empty changes.
1 parent b46df4a commit 43db05f

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ public function data_html_with_inner_markup_changes() {
5353
'Unclosed nested element' => array( '<div><p target>One thought<p>And another', '', '<div><p target><p>And another' ),
5454
'Partially-closed element' => array( '<div target>This is <em>all</em> inside the DIV</div', '', '<div target>' ),
5555
'Implicitly-closed element' => array( '<div><p target>Inside the P</div>Outside the P</p>', '', '<div><p target></div>Outside the P</p>' ),
56+
57+
'Text markup' => array( '<span target></span>', 'Today is the best day to start.', '<span target>Today is the best day to start.</span>' ),
58+
'Text with ampersand (raw)' => array( '<span target></span>', 'Today & yesterday are the best days to start.', '<span target>Today & yesterday are the best days to start.</span>' ),
59+
'Text with tag (raw)' => array( '<span target></span>', 'Yesterday <em>was</em> the best day to start.', '<span target>Yesterday <em>was</em> the best day to start.</span>' ),
60+
'Text with unclosed tag (raw)' => array( '<span target></span>', 'Yesterday <em>was the best day to start.', '<span target>Yesterday <em>was the best day to start.</span>' ),
61+
'Text with ending tag (raw)' => array( '<span target></span>', 'Here is no </div>', '<span target>Here is no </div></span>' ),
62+
'Text with scope-creating tag (raw)' => array( '<span target></span>', '<p>Start<p>Finish<p>Repeat', '<span target><p>Start<p>Finish<p>Repeat</span>' ),
63+
'Text with scope-ending tag (raw)' => array( '<span target></span>', 'Sneaky closing </span> No more span.', '<span target>Sneaky closing </span> No more span.</span>' ),
5664
);
5765

5866
$inner_html = <<<HTML

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ public function data_html_with_outer_markup_changes() {
5353
'Unclosed nested element' => array( '<div><p target>One thought<p>And another', '', '<div><p>And another' ),
5454
'Partially-closed element' => array( '<div target>This is <em>all</em> inside the DIV</div', '', '' ),
5555
'Implicitly-closed element' => array( '<div><p target>Inside the P</div>Outside the P</p>', '', '<div></div>Outside the P</p>' ),
56+
57+
'Text markup' => array( '<span target></span>', 'Today is the best day to start.', 'Today is the best day to start.' ),
58+
'Text with ampersand (raw)' => array( '<span target></span>', 'Today & yesterday are the best days to start.', 'Today & yesterday are the best days to start.' ),
59+
'Text with tag (raw)' => array( '<span target></span>', 'Yesterday <em>was</em> the best day to start.', 'Yesterday <em>was</em> the best day to start.' ),
60+
'Text with unclosed tag (raw)' => array( '<span target></span>', 'Yesterday <em>was the best day to start.', 'Yesterday <em>was the best day to start.' ),
61+
'Text with ending tag (raw)' => array( '<span target></span>', 'Here is no </div>', 'Here is no </div>' ),
62+
'Text with scope-creating tag (raw)' => array( '<span target></span>', '<p>Start<p>Finish<p>Repeat', '<p>Start<p>Finish<p>Repeat' ),
63+
'Text with scope-ending tag (raw)' => array( '<span target></span>', 'Sneaky closing </span> No more span.', 'Sneaky closing </span> No more span.' ),
5664
);
5765

5866
/*

0 commit comments

Comments
 (0)