Skip to content
Merged
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
Next Next commit
Tests for block-level presets
  • Loading branch information
oandregal committed Dec 7, 2021
commit 45d91ca6446304eee6d437e03015157b110a215f
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