summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--core/assets/schemas/v1/metadata-full.schema.json1
-rw-r--r--core/assets/schemas/v1/metadata.schema.json1
-rw-r--r--core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php13
3 files changed, 15 insertions, 0 deletions
diff --git a/core/assets/schemas/v1/metadata-full.schema.json b/core/assets/schemas/v1/metadata-full.schema.json
index 8cda1cb413b2..ac275eb1bdfb 100644
--- a/core/assets/schemas/v1/metadata-full.schema.json
+++ b/core/assets/schemas/v1/metadata-full.schema.json
@@ -4,6 +4,7 @@
"$defs": {
"slotDefinition": {
"type": "object",
+ "additionalProperties": false,
"patternProperties": {
"^[a-zA-Z0-9_-]+$": {
"type": "object",
diff --git a/core/assets/schemas/v1/metadata.schema.json b/core/assets/schemas/v1/metadata.schema.json
index b8e6b6119b30..5e5c753360fd 100644
--- a/core/assets/schemas/v1/metadata.schema.json
+++ b/core/assets/schemas/v1/metadata.schema.json
@@ -4,6 +4,7 @@
"$defs": {
"slotDefinition": {
"type": "object",
+ "additionalProperties": false,
"patternProperties": {
"^[a-zA-Z0-9_-]+$": {
"type": "object",
diff --git a/core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php b/core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php
index 84d87390552d..7e706edcfe0e 100644
--- a/core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php
@@ -124,6 +124,19 @@ class ComponentValidatorTest extends TestCase {
];
yield 'invalid slot (type)' => [$cta_with_invalid_slot_type];
+ $cta_with_invalid_slot_name = $valid_cta;
+ $cta_with_invalid_slot_name['slots'] = [
+ 'valid_slot' => [
+ 'title' => 'Valid slot',
+ 'description' => 'Valid slot description',
+ ],
+ 'invalid slot' => [
+ 'title' => 'Invalid slot',
+ 'description' => 'Slot name cannot have spaces',
+ ],
+ ];
+ yield 'invalid slot (name with spaces)' => [$cta_with_invalid_slot_name];
+
$cta_with_invalid_variant_title_type = $valid_cta;
$cta_with_invalid_variant_title_type['variants'] = [
'valid_variant' => [