feat: add JavaScript lesson section with starter lessons and sidebar section grouping headers
Implementation following plan: - S01: Update JSON schema to support 'javascript' mode - S02: Install @codemirror/lang-javascript dependency - S03: Define JavaScript section in sections.js - S04: Create 3 JavaScript lesson JSON files (variables, DOM, events) - S05: Add JavaScript validation support in validator.js - S06: Add JavaScript preview rendering in LessonEngine.js - S07: Add JavaScript CodeMirror mode and editor config - S08: Register JavaScript modules in all language stores - S09: Add JavaScript section to landing page, navigation, and app config - S10: Add sidebar section grouping headers with category mapping - S11: Update tests for JavaScript mode and section headers
This commit is contained in:
@@ -27,7 +27,35 @@ describe("Lessons Config Module", () => {
|
||||
modules.forEach((module) => {
|
||||
module.lessons.forEach((lesson) => {
|
||||
expect(lesson.mode).toBeDefined();
|
||||
expect(["html", "css", "tailwind", "markdown", "playground"]).toContain(lesson.mode);
|
||||
expect(["html", "css", "tailwind", "markdown", "javascript", "playground"]).toContain(lesson.mode);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("JavaScript modules", () => {
|
||||
test("should include JavaScript modules", async () => {
|
||||
const modules = await loadModules();
|
||||
const moduleIds = modules.map((m) => m.id);
|
||||
|
||||
expect(moduleIds).toContain("js-variables");
|
||||
expect(moduleIds).toContain("js-dom");
|
||||
expect(moduleIds).toContain("js-events");
|
||||
});
|
||||
|
||||
test("JavaScript modules should have correct mode and structure", async () => {
|
||||
const modules = await loadModules();
|
||||
const jsModules = modules.filter((m) => m.mode === "javascript");
|
||||
|
||||
expect(jsModules.length).toBe(3);
|
||||
|
||||
jsModules.forEach((module) => {
|
||||
expect(module.lessons.length).toBeGreaterThanOrEqual(3);
|
||||
module.lessons.forEach((lesson) => {
|
||||
expect(lesson.mode).toBe("javascript");
|
||||
expect(lesson.validations.length).toBeGreaterThan(0);
|
||||
expect(lesson.task).toBeTruthy();
|
||||
expect(lesson.solution).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user