Changeset 63340
- Timestamp:
- 08/23/2026 06:07:11 AM (3 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-includes/blocks.php (modified) (2 diffs)
-
tests/phpunit/tests/post/getTheExcerpt.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks.php
r63320 r63340 2255 2255 'core/html', 2256 2256 'core/list', 2257 'core/list-item', 2257 2258 'core/media-text', 2258 2259 'core/paragraph', … … 2268 2269 'core/column', 2269 2270 'core/group', 2271 'core/list', 2270 2272 ); 2271 2273 -
trunk/tests/phpunit/tests/post/getTheExcerpt.php
r51348 r63340 149 149 /** 150 150 * @ticket 53604 151 * @ticket 63909 151 152 */ 152 153 public function test_inner_blocks_excerpt() { … … 181 182 <!-- /wp:paragraph -->'; 182 183 184 $content_3 = '<!-- wp:list --> 185 <ul class="wp-block-list"><!-- wp:list-item --> 186 <li>List item inside a list.</li> 187 <!-- /wp:list-item --></ul> 188 <!-- /wp:list --> 189 190 <!-- wp:paragraph --> 191 <p></p> 192 <!-- /wp:paragraph -->'; 193 183 194 $post_1 = self::factory()->post->create_and_get( 184 195 array( … … 191 202 array( 192 203 'post_content' => $content_2, 204 'post_excerpt' => '', 205 ) 206 ); 207 208 $post_3 = self::factory()->post->create_and_get( 209 array( 210 'post_content' => $content_3, 193 211 'post_excerpt' => '', 194 212 ) … … 204 222 get_the_excerpt( ( new WP_Query( array( 'p' => $post_2->ID ) ) )->posts[0] ) 205 223 ); 224 225 $this->assertSame( 226 'List item inside a list.', 227 get_the_excerpt( ( new WP_Query( array( 'p' => $post_3->ID ) ) )->posts[0] ) 228 ); 229 } 230 231 /** 232 * Legacy List blocks store their items as raw HTML instead of inner blocks. 233 * They should still contribute to the excerpt, both on their own and when 234 * nested inside another block. 235 * 236 * @ticket 63909 237 */ 238 public function test_legacy_list_block_excerpt() { 239 $content_1 = '<!-- wp:list --> 240 <ul class="wp-block-list"><li>Legacy list item.</li></ul> 241 <!-- /wp:list -->'; 242 243 $content_2 = '<!-- wp:quote --> 244 <blockquote class="wp-block-quote"><!-- wp:list --> 245 <ul class="wp-block-list"><li>Quoted legacy list item.</li></ul> 246 <!-- /wp:list --></blockquote> 247 <!-- /wp:quote -->'; 248 249 $post_1 = self::factory()->post->create_and_get( 250 array( 251 'post_content' => $content_1, 252 'post_excerpt' => '', 253 ) 254 ); 255 256 $post_2 = self::factory()->post->create_and_get( 257 array( 258 'post_content' => $content_2, 259 'post_excerpt' => '', 260 ) 261 ); 262 263 $this->assertSame( 264 'Legacy list item.', 265 get_the_excerpt( ( new WP_Query( array( 'p' => $post_1->ID ) ) )->posts[0] ) 266 ); 267 268 $this->assertSame( 269 'Quoted legacy list item.', 270 get_the_excerpt( ( new WP_Query( array( 'p' => $post_2->ID ) ) )->posts[0] ) 271 ); 206 272 } 207 273 }
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)