From b42ad8cee60aa4c838d89e5f9e284016cee7c50c Mon Sep 17 00:00:00 2001 From: ChristopheCode <135648470+ChristopheCode@users.noreply.github.com> Date: Sun, 21 Jun 2026 20:03:45 +0200 Subject: [PATCH 1/3] Load flashcard progress on exam page --- exam.html | 1 + 1 file changed, 1 insertion(+) diff --git a/exam.html b/exam.html index 44794ae..10bcd8a 100644 --- a/exam.html +++ b/exam.html @@ -120,6 +120,7 @@

How to use

+ From 3d1af99e93bb3ad377d115e00c63208e8b0a49c7 Mon Sep 17 00:00:00 2001 From: ChristopheCode <135648470+ChristopheCode@users.noreply.github.com> Date: Sun, 21 Jun 2026 20:04:23 +0200 Subject: [PATCH 2/3] Record exam answers in flashcard progress --- exam.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exam.js b/exam.js index 4aaa21b..97ee554 100644 --- a/exam.js +++ b/exam.js @@ -88,9 +88,11 @@ function onPick(value, btn) { locked = true; const ans = window.VerbUtils.correctAnswer(currentV, currentT); + const isCorrect = value === ans; choicesEl.querySelectorAll('button').forEach(b => b.disabled = true); + window.FlashcardProgress?.recordAnswer(currentV, isCorrect); - if (value === ans) { + if (isCorrect) { score++; btn.classList.add('correct'); feedbackEl.textContent = '✅ Correct!'; From 99a5a52188b4512be106930cdacb0977ac84cb47 Mon Sep 17 00:00:00 2001 From: ChristopheCode <135648470+ChristopheCode@users.noreply.github.com> Date: Sun, 21 Jun 2026 20:04:56 +0200 Subject: [PATCH 3/3] Test exam flashcard progress storage --- tests/smoke.spec.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/smoke.spec.js b/tests/smoke.spec.js index cc39445..29e294a 100644 --- a/tests/smoke.spec.js +++ b/tests/smoke.spec.js @@ -93,7 +93,7 @@ test('Exercises can answer, save progress, and move to next question', async ({ expect(errors).toEqual([]); }); -test('Exam can complete 10 questions and show final result', async ({ page }) => { +test('Exam can complete 10 questions, save progress, and show final result', async ({ page }) => { const errors = trackPageErrors(page); await page.goto(pageUrl('exam.html')); @@ -103,6 +103,13 @@ test('Exam can complete 10 questions and show final result', async ({ page }) => await page.locator('#nextExamBtn').click(); } + const progressRaw = await page.evaluate(() => window.localStorage.casualEnglishFlashcardProgress || null); + expect(progressRaw).not.toBeNull(); + + const progress = JSON.parse(progressRaw); + const totalViews = Object.values(progress).reduce((sum, entry) => sum + entry.views, 0); + expect(totalViews).toBe(10); + await expect(page.locator('#result')).toBeVisible(); await expect(page.locator('#resultScore')).toContainText('/ 10'); await expect(page.locator('#restartBtn')).toBeVisible();