Skip to content

Commit

Permalink
Revert "Revert test data for WithSlug variation (#62579)"
Browse files Browse the repository at this point in the history
This reverts commit 2917269.
  • Loading branch information
oandregal committed Jun 17, 2024
1 parent 6633dc3 commit 3d05810
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
23 changes: 23 additions & 0 deletions phpunit/block-supports/block-style-variations-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,22 @@ public function test_add_registered_block_styles_to_theme_data() {
),
);

/*
* This style is to be deliberately overwritten by the theme.json partial
* See `phpunit/data/themedir1/block-theme/styles/block-style-variation-with-slug.json`.
*/
register_block_style(
'core/group',
array(
'name' => 'WithSlug',
'style_data' => array(
'color' => array(
'background' => 'whitesmoke',
'text' => 'black',
),
),
)
);
register_block_style(
'core/group',
array(
Expand All @@ -106,6 +122,12 @@ public function test_add_registered_block_styles_to_theme_data() {
$group_styles = $theme_json['styles']['blocks']['core/group'] ?? array();
$expected = array(
'variations' => array(
'WithSlug' => array(
'color' => array(
'background' => 'aliceblue',
'text' => 'midnightblue',
),
),
'my-variation' => $variation_styles_data,

/*
Expand All @@ -129,6 +151,7 @@ public function test_add_registered_block_styles_to_theme_data() {
);

unregister_block_style( 'core/group', 'my-variation' );
unregister_block_style( 'core/group', 'WithSlug' );

$this->assertSameSetsWithIndex( $group_styles, $expected );
}
Expand Down
12 changes: 12 additions & 0 deletions phpunit/class-wp-theme-json-resolver-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,18 @@ public function data_get_style_variations() {
),
),
),
array(
'blockTypes' => array( 'core/group', 'core/columns' ),
'version' => 3,
'slug' => 'WithSlug',
'title' => 'With Slug',
'styles' => array(
'color' => array(
'background' => 'aliceblue',
'text' => 'midnightblue',
),
),
),
),
),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 3,
"blockTypes": [ "core/group", "core/columns" ],
"slug": "WithSlug",
"title": "With Slug",
"styles": {
"color": {
"background": "aliceblue",
"text": "midnightblue"
}
}
}

0 comments on commit 3d05810

Please sign in to comment.