Skip to content

Commit

Permalink
Tests for block-level presets
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Dec 7, 2021
1 parent d9192bb commit 45d91ca
Showing 1 changed file with 71 additions and 3 deletions.
74 changes: 71 additions & 3 deletions phpunit/class-wp-theme-json-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ public function test_merge_incoming_data_color_presets_with_same_slugs_as_defaul
array(
'version' => WP_Theme_JSON_Gutenberg::LATEST_SCHEMA,
'settings' => array(
'color' => array(
'color' => array(
'defaultPalette' => true, // Emulate the defaults from core theme.json.
'palette' => array(
array(
Expand All @@ -1241,6 +1241,19 @@ public function test_merge_incoming_data_color_presets_with_same_slugs_as_defaul
),
),
),
'blocks' => array(
'core/paragraph' => array(
'color' => array(
'palette' => array(
array(
'slug' => 'blue',
'color' => 'blue',
'name' => 'Blue',
),
),
),
),
),
),
),
'default'
Expand All @@ -1249,7 +1262,7 @@ public function test_merge_incoming_data_color_presets_with_same_slugs_as_defaul
array(
'version' => WP_Theme_JSON_Gutenberg::LATEST_SCHEMA,
'settings' => array(
'color' => array(
'color' => array(
'defaultPalette' => false,
'palette' => array(
array(
Expand All @@ -1264,14 +1277,37 @@ public function test_merge_incoming_data_color_presets_with_same_slugs_as_defaul
),
),
),
'blocks' => array(
'core/paragraph' => array(
'color' => array(
'palette' => array(
array(
'slug' => 'blue',
'color' => 'blue',
'name' => 'Bluish',
),
array(
'slug' => 'yellow',
'color' => 'yellow',
'name' => 'Yellow',
),
array(
'slug' => 'green',
'color' => 'green',
'name' => 'Block Green',
),
),
),
),
),
),
)
);

$expected = array(
'version' => WP_Theme_JSON_Gutenberg::LATEST_SCHEMA,
'settings' => array(
'color' => array(
'color' => array(
'defaultPalette' => false,
'palette' => array(
'default' => array(
Expand Down Expand Up @@ -1300,6 +1336,38 @@ public function test_merge_incoming_data_color_presets_with_same_slugs_as_defaul
),
),
),
'blocks' => array(
'core/paragraph' => array(
'color' => array(
'palette' => array(
'default' => array(
array(
'slug' => 'blue',
'color' => 'blue',
'name' => 'Blue',
),
),
'theme' => array(
array(
'slug' => 'blue',
'color' => 'blue',
'name' => 'Bluish',
),
array(
'slug' => 'yellow',
'color' => 'yellow',
'name' => 'Yellow',
),
array(
'slug' => 'green',
'color' => 'green',
'name' => 'Block Green',
),
),
),
),
),
),
),
);

Expand Down

0 comments on commit 45d91ca

Please sign in to comment.