Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/wp-includes/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down
40 changes: 40 additions & 0 deletions tests/phpunit/tests/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading