File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -1297,6 +1297,34 @@ public function test_image_block_in_two_column_layout_renders_correct_sizes_attr
1297
1297
$ this ->assertStringContainsString ( 'sizes="(max-width: 310px) 100vw, 310px" ' , $ result );
1298
1298
}
1299
1299
1300
+ /**
1301
+ * Test that the image block in a three-column layout renders the correct sizes attribute.
1302
+ */
1303
+ public function test_image_block_in_three_column_layout_renders_correct_sizes_attribute (): void {
1304
+ // Skip test for WordPress versions below 6.8.
1305
+ if ( version_compare ( get_bloginfo ( 'version ' ), '6.8 ' , '< ' ) ) {
1306
+ $ this ->markTestSkipped ( 'This test requires WordPress 6.8 or higher. ' );
1307
+ }
1308
+
1309
+ $ block_content = '<!-- wp:columns -->
1310
+ <div class="wp-block-columns"><!-- wp:column -->
1311
+ <div class="wp-block-column">
1312
+ ' . $ this ->get_image_block_markup ( self ::$ image_id , 'large ' ) . '
1313
+ </div>
1314
+ <!-- /wp:column -->
1315
+ <!-- wp:column -->
1316
+ <div class="wp-block-column"></div>
1317
+ <!-- /wp:column -->
1318
+ <!-- wp:column -->
1319
+ <div class="wp-block-column"></div>
1320
+ <!-- /wp:column --></div>
1321
+ <!-- /wp:columns --> ' ;
1322
+
1323
+ $ result = apply_filters ( 'the_content ' , $ block_content );
1324
+
1325
+ $ this ->assertStringContainsString ( 'sizes="(max-width: 206px) 100vw, 206px" ' , $ result );
1326
+ }
1327
+
1300
1328
/**
1301
1329
* Verifies that the post featured image block does not render when no featured image is set for the post.
1302
1330
*/
You can’t perform that action at this time.
0 commit comments