Skip to content

Commit

Permalink
Add block style tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Jul 31, 2024
1 parent bcfd6b3 commit 8485950
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/phpunit/tests/theme/wpThemeJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -5045,6 +5045,7 @@ public function test_get_top_level_background_image_styles() {

/**
* @ticket 61588
* @ticket 61720
*/
public function test_get_block_background_image_styles() {
$theme_json = new WP_Theme_JSON(
Expand All @@ -5054,10 +5055,11 @@ public function test_get_block_background_image_styles() {
'blocks' => array(
'core/group' => array(
'background' => array(
'backgroundImage' => "url('http://example.org/group.png')",
'backgroundSize' => 'cover',
'backgroundRepeat' => 'no-repeat',
'backgroundPosition' => 'center center',
'backgroundImage' => "url('http://example.org/group.png')",
'backgroundSize' => 'cover',
'backgroundRepeat' => 'no-repeat',
'backgroundPosition' => 'center center',
'backgroundAttachment' => 'fixed',
),
),
'core/quote' => array(
Expand Down Expand Up @@ -5096,7 +5098,7 @@ public function test_get_block_background_image_styles() {
),
);

$group_styles = ":root :where(.wp-block-group){background-image: url('http://example.org/group.png');background-position: center center;background-repeat: no-repeat;background-size: cover;}";
$group_styles = ":root :where(.wp-block-group){background-image: url('http://example.org/group.png');background-position: center center;background-repeat: no-repeat;background-size: cover;background-attachment: fixed;}";
$this->assertSame( $group_styles, $theme_json->get_styles_for_block( $group_node ), 'Styles returned from "::get_styles_for_block()" with block-level background styles as string type do not match expectations' );
}

Expand Down

0 comments on commit 8485950

Please sign in to comment.