From 4e55e00fa5d9914a302f5917e4c96de1359cdd3f Mon Sep 17 00:00:00 2001 From: Mia Zbikowski Date: Tue, 18 Feb 2025 17:43:50 -0500 Subject: [PATCH] Allow Names on Preset Blocks --- schemas/theme/preset_blocks.json | 6 ++++++ tests/fixtures/section-nested-blocks.json | 2 +- .../fixtures/section-schema-preset-blocks-as-hash.json | 1 + tests/fixtures/theme-block-basics.json | 10 +++++++++- tests/fixtures/theme-block-presets-as-hash.json | 4 +++- 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/schemas/theme/preset_blocks.json b/schemas/theme/preset_blocks.json index 1cad069..6849203 100644 --- a/schemas/theme/preset_blocks.json +++ b/schemas/theme/preset_blocks.json @@ -16,6 +16,7 @@ "properties": { "static": true, "type": true, + "name": true, "settings": true, "blocks": { "$ref": "#/definitions/blocksArray" @@ -52,6 +53,7 @@ "properties": { "static": true, "type": true, + "name": true, "settings": true, "blocks": { "$ref": "#/definitions/blocksHash" @@ -72,6 +74,10 @@ "type": "string", "description": "The block type." }, + "name": { + "type": "string", + "description": "The block name." + }, "settings": { "$ref": "./default_setting_values.json" }, diff --git a/tests/fixtures/section-nested-blocks.json b/tests/fixtures/section-nested-blocks.json index e976c66..e382775 100644 --- a/tests/fixtures/section-nested-blocks.json +++ b/tests/fixtures/section-nested-blocks.json @@ -9,7 +9,7 @@ "type": "group", "blocks": [ { "type": "text", "settings": { "text": "Hello" } }, - { "type": "header", "settings": { "text": "World" } } + { "type": "header", "name": "Header", "settings": { "text": "World" } } ] } ] diff --git a/tests/fixtures/section-schema-preset-blocks-as-hash.json b/tests/fixtures/section-schema-preset-blocks-as-hash.json index cd4dadb..c435a3b 100644 --- a/tests/fixtures/section-schema-preset-blocks-as-hash.json +++ b/tests/fixtures/section-schema-preset-blocks-as-hash.json @@ -14,6 +14,7 @@ "blocks": { "exampleBlock": { "type": "text", + "name": "Example Block", "settings": {} }, "exampleBlock2": { diff --git a/tests/fixtures/theme-block-basics.json b/tests/fixtures/theme-block-basics.json index e5df033..da76e21 100644 --- a/tests/fixtures/theme-block-basics.json +++ b/tests/fixtures/theme-block-basics.json @@ -24,9 +24,17 @@ "blocks": [ { "type": "thing", + "name": "The Thing", "settings": { "some-setting": "some-value" - } + }, + "blocks": [ + { + "type": "text", + "name": "Nested Text Block", + "settings": {} + } + ] }, { "type": "button", diff --git a/tests/fixtures/theme-block-presets-as-hash.json b/tests/fixtures/theme-block-presets-as-hash.json index a480e68..6b42a67 100644 --- a/tests/fixtures/theme-block-presets-as-hash.json +++ b/tests/fixtures/theme-block-presets-as-hash.json @@ -27,13 +27,15 @@ }, "some-other-block-id": { "type": "image", + "name": "Image Block", "static": true, "settings": { "some-setting": "some-value" }, "blocks": { "nested-block-id": { - "type": "text" + "type": "text", + "name": "Nested Text Block" } }, "block_order": ["nested-block-id"]