@@ -273,14 +273,14 @@ public function data_image_sizes_for_left_right_center_alignment(): array {
273
273
'sizes="(max-width: 300px) 100vw, 300px" ' ,
274
274
'center ' ,
275
275
),
276
- 'Return large image size 1024px with center alignment ' => array (
276
+ 'Return large image size 620px with center alignment ' => array (
277
277
'large ' ,
278
- 'sizes="(max-width: 1024px ) 100vw, 1024px " ' ,
278
+ 'sizes="(max-width: 620px ) 100vw, 620px " ' ,
279
279
'center ' ,
280
280
),
281
- 'Return full image size 1080px with center alignment ' => array (
281
+ 'Return full image size 620px with center alignment ' => array (
282
282
'full ' ,
283
- 'sizes="(max-width: 1080px ) 100vw, 1080px " ' ,
283
+ 'sizes="(max-width: 620px ) 100vw, 620px " ' ,
284
284
'center ' ,
285
285
),
286
286
'Return resized size 100px instead of medium image size 300px with left alignment ' => array (
@@ -346,8 +346,9 @@ public function data_image_sizes_for_left_right_center_alignment(): array {
346
346
* @dataProvider data_image_left_right_center_alignment
347
347
*
348
348
* @param string $alignment Alignment of the image.
349
+ * @param string $expected Expected output.
349
350
*/
350
- public function test_cover_block_with_left_right_center_alignment ( string $ alignment ): void {
351
+ public function test_cover_block_with_left_right_center_alignment ( string $ alignment, string $ expected ): void {
351
352
$ image_url = wp_get_attachment_image_url ( self ::$ image_id , 'full ' );
352
353
$ block_content = '<!-- wp:cover {"url":" ' . $ image_url . '","id": ' . self ::$ image_id . ',"dimRatio":50,"align":" ' . $ alignment . '","style":{"color":{}}} -->
353
354
<div class="wp-block-cover align ' . $ alignment . '"><span aria-hidden="true" class="wp-block-cover__background has-background-dim"></span><img class="wp-block-cover__image-background wp-image- ' . self ::$ image_id . '" alt="" src=" ' . $ image_url . '" data-object-fit="cover"/><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","fontSize":"large"} -->
@@ -357,7 +358,7 @@ public function test_cover_block_with_left_right_center_alignment( string $align
357
358
358
359
$ result = apply_filters ( 'the_content ' , $ block_content );
359
360
360
- $ this ->assertStringContainsString ( ' sizes="(max-width: 1080px) 100vw, 1080px" ' , $ result );
361
+ $ this ->assertStringContainsString ( $ expected , $ result );
361
362
}
362
363
363
364
/**
@@ -367,9 +368,9 @@ public function test_cover_block_with_left_right_center_alignment( string $align
367
368
*/
368
369
public function data_image_left_right_center_alignment (): array {
369
370
return array (
370
- array ( 'left ' ),
371
- array ( 'right ' ),
372
- array ( 'center ' ),
371
+ array ( 'left ' , ' sizes="(max-width: 420px) 100vw, 420px ' ),
372
+ array ( 'right ' , ' sizes="(max-width: 420px) 100vw, 420px ' ),
373
+ array ( 'center ' , ' sizes="(max-width: 620px) 100vw, 620px ' ),
373
374
);
374
375
}
375
376
0 commit comments