feat: add solution code and enhance validation rules for basic selectors lesson

This commit is contained in:
Michael Czechowski
2025-05-19 23:42:04 +02:00
parent 6c7ef3ff0b
commit 391eb25d4b
2 changed files with 141 additions and 131 deletions

View File

@@ -193,6 +193,7 @@
"initialCode": "", "initialCode": "",
"codeSuffix": "", "codeSuffix": "",
"previewContainer": "preview-area", "previewContainer": "preview-area",
"solution": ".card.featured { border-color: gold; background-color: lemonchiffon }",
"validations": [ "validations": [
{ {
"type": "regex", "type": "regex",
@@ -215,6 +216,11 @@
}, },
"message": "Set the border color to <kbd>gold</kbd>" "message": "Set the border color to <kbd>gold</kbd>"
}, },
{
"type": "regex",
"value": "\\.card\\.featured\\s*{[^}]*;",
"message": "Make sure to end your CSS rule with a semicolon <kbd>;</kbd>"
},
{ {
"type": "contains", "type": "contains",
"value": "background-color:", "value": "background-color:",

View File

@@ -83,6 +83,10 @@
"type": "string", "type": "string",
"description": "Code that appears after the editable area" "description": "Code that appears after the editable area"
}, },
"solution": {
"type": "string",
"description": "Solution code for the lesson, if applicable"
},
"previewContainer": { "previewContainer": {
"type": "string", "type": "string",
"description": "ID of the container element for the preview" "description": "ID of the container element for the preview"