File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1272,6 +1272,31 @@ public static function data_image_block_with_parent_columns_and_its_parent_group
1272
1272
);
1273
1273
}
1274
1274
1275
+ /**
1276
+ * Test that the image block in a two-column layout renders the correct sizes attribute.
1277
+ */
1278
+ public function test_image_block_in_two_column_layout_renders_correct_sizes_attribute (): void {
1279
+ // Skip test for WordPress versions below 6.8.
1280
+ if ( version_compare ( get_bloginfo ( 'version ' ), '6.8 ' , '< ' ) ) {
1281
+ $ this ->markTestSkipped ( 'This test requires WordPress 6.8 or higher. ' );
1282
+ }
1283
+
1284
+ $ block_content = '<!-- wp:columns -->
1285
+ <div class="wp-block-columns"><!-- wp:column -->
1286
+ <div class="wp-block-column">
1287
+ ' . $ this ->get_image_block_markup ( self ::$ image_id , 'large ' ) . '
1288
+ </div>
1289
+ <!-- /wp:column -->
1290
+ <!-- wp:column -->
1291
+ <div class="wp-block-column"></div>
1292
+ <!-- /wp:column --></div>
1293
+ <!-- /wp:columns --> ' ;
1294
+
1295
+ $ result = apply_filters ( 'the_content ' , $ block_content );
1296
+
1297
+ $ this ->assertStringContainsString ( 'sizes="(max-width: 310px) 100vw, 310px" ' , $ result );
1298
+ }
1299
+
1275
1300
/**
1276
1301
* Verifies that the post featured image block does not render when no featured image is set for the post.
1277
1302
*/
You can’t perform that action at this time.
0 commit comments