diff --git a/src/wp-includes/block-supports/layout.php b/src/wp-includes/block-supports/layout.php index 855b01764d169..dd6f7182a452c 100644 --- a/src/wp-includes/block-supports/layout.php +++ b/src/wp-includes/block-supports/layout.php @@ -765,7 +765,11 @@ function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false ); if ( 'horizontal' === $layout_orientation ) { - $justify_content_options += array( 'space-between' => 'space-between' ); + $justify_content_options += array( + 'space-between' => 'space-between', + 'space-around' => 'space-around', + 'space-evenly' => 'space-evenly', + ); $vertical_alignment_options += array( 'stretch' => 'stretch' ); } else { $justify_content_options += array( 'stretch' => 'stretch' ); diff --git a/tests/phpunit/tests/block-supports/layout.php b/tests/phpunit/tests/block-supports/layout.php index c1c121c9e2102..fe01d0e7b85f2 100644 --- a/tests/phpunit/tests/block-supports/layout.php +++ b/tests/phpunit/tests/block-supports/layout.php @@ -1365,6 +1365,46 @@ static function ( $theme_json ) use ( &$user_data_resolutions ) { ); } + /** + * Tests additional flex justification values. + * + * @dataProvider data_wp_get_layout_style_with_additional_flex_justification + * + * @covers ::wp_get_layout_style + * + * @param array $layout Flex layout values. + * @param string $expected_output The expected output. + */ + public function test_wp_get_layout_style_with_additional_flex_justification( $layout, $expected_output ) { + $this->assertSame( $expected_output, wp_get_layout_style( '.wp-layout', $layout ) ); + } + + /** + * Data provider for test_wp_get_layout_style_with_additional_flex_justification(). + * + * @return array + */ + public function data_wp_get_layout_style_with_additional_flex_justification() { + return array( + 'horizontal flex layout with space-around justification' => array( + 'layout' => array( + 'type' => 'flex', + 'orientation' => 'horizontal', + 'justifyContent' => 'space-around', + ), + 'expected_output' => '.wp-layout{justify-content:space-around;}', + ), + 'horizontal flex layout with space-evenly justification' => array( + 'layout' => array( + 'type' => 'flex', + 'orientation' => 'horizontal', + 'justifyContent' => 'space-evenly', + ), + 'expected_output' => '.wp-layout{justify-content:space-evenly;}', + ), + ); + } + /** * Tests that a constrained layout with non-string contentSize/wideSize/justifyContent * values (e.g. from hand-edited, imported, or AI-generated content) does not cause a