Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Rename variations to account for child overwriting parent variation.
  • Loading branch information
jffng committed Jan 17, 2023
commit fcfbc1246ffa88b0c19ee03e0491ecee0a3e7a3a
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"
}
]
}
}
}
}
}