From 59bb6c636b4275887c838a43739184a1c686a552 Mon Sep 17 00:00:00 2001 From: Sukhendu Sekhar Guria Date: Thu, 24 Sep 2026 17:43:41 +0530 Subject: [PATCH] Block Supports: Add additional flex justification options --- src/wp-includes/block-supports/layout.php | 6 ++- tests/phpunit/tests/block-supports/layout.php | 40 +++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/block-supports/layout.php b/src/wp-includes/block-supports/layout.php index dc9dc0768cdf2..440bc3dd438c9 100644 --- a/src/wp-includes/block-supports/layout.php +++ b/src/wp-includes/block-supports/layout.php @@ -733,7 +733,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 2a8c7fc88cd6b..3dc0278be8825 100644 --- a/tests/phpunit/tests/block-supports/layout.php +++ b/tests/phpunit/tests/block-supports/layout.php @@ -1189,6 +1189,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