Skip to content

Commit fcfbc12

Browse files
committed
Rename variations to account for child overwriting parent variation.
1 parent 7877289 commit fcfbc12

4 files changed

Lines changed: 28 additions & 9 deletions

File tree

phpunit/class-wp-theme-json-resolver-test.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,8 @@ public function data_get_merged_data_returns_origin() {
505505

506506

507507
/**
508-
* Test that get_style_variations returns all variations, including parent theme variations if the theme is a child.
508+
* Test that get_style_variations returns all variations, including parent theme variations if the theme is a child,
509+
* and that the child variation overwrites the parent variation of the same name.
509510
*
510511
* @covers WP_Theme_JSON_Resolver::get_style_variations
511512
**/
@@ -518,17 +519,17 @@ public function test_get_style_variations_returns_all_variations() {
518519
$expected_settings = array(
519520
array(
520521
'version' => 2,
521-
'title' => 'variation-child',
522+
'title' => 'variation-a',
522523
'settings' => array(
523524
'blocks' => array(
524-
'core/post-title' => array(
525+
'core/paragraph' => array(
525526
'color' => array(
526527
'palette' => array(
527528
'theme' => array(
528529
array(
529-
'slug' => 'light',
530-
'name' => 'Light',
531-
'color' => '#f1f1f1',
530+
'slug' => 'dark',
531+
'name' => 'Dark',
532+
'color' => '#010101',
532533
),
533534
),
534535
),
@@ -539,17 +540,17 @@ public function test_get_style_variations_returns_all_variations() {
539540
),
540541
array(
541542
'version' => 2,
542-
'title' => 'variation',
543+
'title' => 'variation-b',
543544
'settings' => array(
544545
'blocks' => array(
545-
'core/paragraph' => array(
546+
'core/post-title' => array(
546547
'color' => array(
547548
'palette' => array(
548549
'theme' => array(
549550
array(
550551
'slug' => 'light',
551552
'name' => 'Light',
552-
'color' => '#f2f2f2',
553+
'color' => '#f1f1f1',
553554
),
554555
),
555556
),
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": 2,
3+
"settings": {
4+
"blocks": {
5+
"core/paragraph": {
6+
"color": {
7+
"palette": [
8+
{
9+
"slug": "dark",
10+
"name": "Dark",
11+
"color": "#010101"
12+
}
13+
]
14+
}
15+
}
16+
}
17+
}
18+
}

phpunit/data/themedir1/block-theme/styles/variation.json renamed to phpunit/data/themedir1/block-theme/styles/variation-a.json

File renamed without changes.

phpunit/data/themedir1/block-theme-child/styles/variation-child.json renamed to phpunit/data/themedir1/block-theme/styles/variation-b.json

File renamed without changes.

0 commit comments

Comments
 (0)