From ebace3b5a97a3003744fe2c6cce9a43e98a2b962 Mon Sep 17 00:00:00 2001 From: thsparks Date: Tue, 29 Oct 2024 14:57:42 -0700 Subject: [PATCH] Add tests --- package.json | 1 + tests/tutorial-test/baselines/hideDone.json | 23 +++++++++++++++++++ .../tutorial-test/baselines/hideToolbox.json | 23 +++++++++++++++++++ tests/tutorial-test/cases/hideDone.md | 20 ++++++++++++++++ tests/tutorial-test/cases/hideToolbox.md | 20 ++++++++++++++++ 5 files changed, 87 insertions(+) create mode 100644 tests/tutorial-test/baselines/hideDone.json create mode 100644 tests/tutorial-test/baselines/hideToolbox.json create mode 100644 tests/tutorial-test/cases/hideDone.md create mode 100644 tests/tutorial-test/cases/hideToolbox.md diff --git a/package.json b/package.json index d145f350562b..fb191be60c2d 100644 --- a/package.json +++ b/package.json @@ -164,6 +164,7 @@ "test:err": "gulp testerr", "test:fmt": "gulp testfmt", "test:lang": "gulp testlang", + "test:tutorials": "gulp testtutorials", "update": "gulp update", "watch-streamer": "cd docs/static/streamer && tsc -t es6 --watch", "prepare": "node ./scripts/npm-prepare.js", diff --git a/tests/tutorial-test/baselines/hideDone.json b/tests/tutorial-test/baselines/hideDone.json new file mode 100644 index 000000000000..a46227a2e28a --- /dev/null +++ b/tests/tutorial-test/baselines/hideDone.json @@ -0,0 +1,23 @@ +{ + "editor": "blocksprj", + "title": "Hide Done", + "steps": [ + { + "contentMd": "Tutorials can choose to hide the done button on the final step. This metadata is parsed and removed.", + "headerContentMd": "Tutorials can choose to hide the done button on the final step. This metadata is parsed and removed." + }, + { + "contentMd": "Tutorial parsing for hints, steps, etc should function exactly as before.\n\n```blocks\nlet x = 8;\nlet y = x + 2;\n```", + "headerContentMd": "Tutorial parsing for hints, steps, etc should function exactly as before.", + "hintContentMd": "```blocks\nlet x = 8;\nlet y = x + 2;\n```" + } + ], + "activities": null, + "code": [ + "{\nlet x = 8;\nlet y = x + 2;\n}", + "{\nbasic.showIcon(IconNames.Square)\n}" + ], + "metadata": { + "hideDone": true + } +} diff --git a/tests/tutorial-test/baselines/hideToolbox.json b/tests/tutorial-test/baselines/hideToolbox.json new file mode 100644 index 000000000000..02a569e2a970 --- /dev/null +++ b/tests/tutorial-test/baselines/hideToolbox.json @@ -0,0 +1,23 @@ +{ + "editor": "blocksprj", + "title": "Hide Toolbox", + "steps": [ + { + "contentMd": "Tutorials can choose to hide the toolbox. This metadata is parsed and removed.", + "headerContentMd": "Tutorials can choose to hide the toolbox. This metadata is parsed and removed." + }, + { + "contentMd": "Tutorial parsing for hints, steps, etc should function exactly as before.\n\n```blocks\nlet x = 8;\nlet y = x + 2;\n```", + "headerContentMd": "Tutorial parsing for hints, steps, etc should function exactly as before.", + "hintContentMd": "```blocks\nlet x = 8;\nlet y = x + 2;\n```" + } + ], + "activities": null, + "code": [ + "{\nlet x = 8;\nlet y = x + 2;\n}", + "{\nbasic.showIcon(IconNames.Square)\n}" + ], + "metadata": { + "hideToolbox": true + } +} diff --git a/tests/tutorial-test/cases/hideDone.md b/tests/tutorial-test/cases/hideDone.md new file mode 100644 index 000000000000..6596085a2ff4 --- /dev/null +++ b/tests/tutorial-test/cases/hideDone.md @@ -0,0 +1,20 @@ +# Hide Done + +### @hideDone true + +## Introduction + +Tutorials can choose to hide the done button on the final step. This metadata is parsed and removed. + +## Step with hint + +Tutorial parsing for hints, steps, etc should function exactly as before. + +```blocks +let x = 8; +let y = x + 2; +``` + +```ghost +basic.showIcon(IconNames.Square) +``` diff --git a/tests/tutorial-test/cases/hideToolbox.md b/tests/tutorial-test/cases/hideToolbox.md new file mode 100644 index 000000000000..4bf31af59ad6 --- /dev/null +++ b/tests/tutorial-test/cases/hideToolbox.md @@ -0,0 +1,20 @@ +# Hide Toolbox + +### @hideToolbox true + +## Introduction + +Tutorials can choose to hide the toolbox. This metadata is parsed and removed. + +## Step with hint + +Tutorial parsing for hints, steps, etc should function exactly as before. + +```blocks +let x = 8; +let y = x + 2; +``` + +```ghost +basic.showIcon(IconNames.Square) +```