Skip to content

Commit

Permalink
Rename variations to account for child overwriting parent variation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jffng committed Jan 17, 2023
1 parent 7877289 commit fcfbc12
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
19 changes: 10 additions & 9 deletions phpunit/class-wp-theme-json-resolver-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,8 @@ public function data_get_merged_data_returns_origin() {


/**
* Test that get_style_variations returns all variations, including parent theme variations if the theme is a child.
* Test that get_style_variations returns all variations, including parent theme variations if the theme is a child,
* and that the child variation overwrites the parent variation of the same name.
*
* @covers WP_Theme_JSON_Resolver::get_style_variations
**/
Expand All @@ -518,17 +519,17 @@ public function test_get_style_variations_returns_all_variations() {
$expected_settings = array(
array(
'version' => 2,
'title' => 'variation-child',
'title' => 'variation-a',
'settings' => array(
'blocks' => array(
'core/post-title' => array(
'core/paragraph' => array(
'color' => array(
'palette' => array(
'theme' => array(
array(
'slug' => 'light',
'name' => 'Light',
'color' => '#f1f1f1',
'slug' => 'dark',
'name' => 'Dark',
'color' => '#010101',
),
),
),
Expand All @@ -539,17 +540,17 @@ public function test_get_style_variations_returns_all_variations() {
),
array(
'version' => 2,
'title' => 'variation',
'title' => 'variation-b',
'settings' => array(
'blocks' => array(
'core/paragraph' => array(
'core/post-title' => array(
'color' => array(
'palette' => array(
'theme' => array(
array(
'slug' => 'light',
'name' => 'Light',
'color' => '#f2f2f2',
'color' => '#f1f1f1',
),
),
),
Expand Down
18 changes: 18 additions & 0 deletions phpunit/data/themedir1/block-theme-child/styles/variation-a.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": 2,
"settings": {
"blocks": {
"core/paragraph": {
"color": {
"palette": [
{
"slug": "dark",
"name": "Dark",
"color": "#010101"
}
]
}
}
}
}
}

0 comments on commit fcfbc12

Please sign in to comment.