- Timestamp:
- 01/27/2026 11:18:32 AM (8 months ago)
- Location:
- branches/6.9
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
tests/phpunit/tests/build-visual-html-tree.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/6.9
-
branches/6.9/tests/phpunit/tests/build-visual-html-tree.php
r60295 r61536 10 10 class Tests_Build_Equivalent_HTML_Semantic_Tree extends WP_UnitTestCase { 11 11 public function data_build_equivalent_html_semantic_tree() { 12 $block_markup = <<< END13 <!-- wp:separator {"className":"is-style-default has-custom-classname","style":{"spacing":{"margin":{"top":"50px","bottom":"50px"}}},"backgroundColor":"accent-1"} -->14 <hr class="wp-block-separator is-style-default has-custom-classname" style="margin-top: 50px; margin-bottom: 50px" />15 <!-- /wp:separator -->16 END;17 18 $tree_structure = <<< END12 $block_markup = <<<'HTML' 13 <!-- wp:separator {"className":"is-style-default has-custom-classname","style":{"spacing":{"margin":{"top":"50px","bottom":"50px"}}},"backgroundColor":"accent-1"} --> 14 <hr class="wp-block-separator is-style-default has-custom-classname" style="margin-top: 50px; margin-bottom: 50px" /> 15 <!-- /wp:separator --> 16 HTML; 17 18 $tree_structure = <<<'TREE' 19 19 BLOCK["core/separator"] 20 20 { … … 30 30 } 31 31 } 32 " 33 " 32 34 <hr> 33 35 class="has-custom-classname is-style-default wp-block-separator" 34 36 style="margin-top:50px;margin-bottom:50px;" 35 36 END; 37 38 return array( 39 'Block delimiter' => array( $block_markup, $tree_structure ), 40 ); 37 " 38 " 39 40 TREE; 41 42 yield 'Block delimiter' => array( $block_markup, $tree_structure ); 43 44 $block_markup = <<<'HTML' 45 <!-- wp:example/block --> 46 One 47 <!-- wp:example/nested-void /--> 48 Two 49 <!-- wp:example/nested --> 50 Three 51 <!-- /wp:example/nested --> 52 Four 53 <!-- /wp:example/block --> 54 HTML; 55 56 $tree_structure = <<<'TREE' 57 BLOCK["example/block"] 58 " 59 One 60 " 61 BLOCK["example/nested-void"] 62 " 63 Two 64 " 65 BLOCK["example/nested"] 66 " 67 Three 68 " 69 " 70 Four 71 " 72 73 TREE; 74 75 yield 'Text nodes in blocks' => array( $block_markup, $tree_structure ); 41 76 } 42 77 43 78 /** 44 79 * @ticket 63527 80 * @ticket 64531 45 81 * 46 82 * @covers ::build_visual_html_tree … … 142 178 $this->assertNotSame( $tree_expected, $tree_actual ); 143 179 } 180 181 /** 182 * @ticket 64531 183 * 184 * @covers ::build_visual_html_tree 185 */ 186 public function test_spacing() { 187 $html = <<<'HTML' 188 <p> space-surrounded </p> 189 <p> nbsp-surrounded </p> 190 <p> 191 newline-surrounded
</p> 192 <p>	tab-surrounded </p> 193 <p>ok</p> 194 HTML; 195 196 $expected = <<<TREE 197 <p> 198 " space-surrounded " 199 "\n" 200 <p> 201 "\u{00A0}nbsp-surrounded\u{00A0}" 202 "\n" 203 <p> 204 "\nnewline-surrounded\n" 205 "\n" 206 <p> 207 "\ttab-surrounded\t" 208 "\n" 209 <p> 210 "ok" 211 212 TREE; 213 214 $tree_result = build_visual_html_tree( $html, '<body>' ); 215 $this->assertSame( $expected, $tree_result ); 216 } 144 217 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)