Files
CatoandClaude 0a57ad24a8 feat(practice): the start card comes first, a chosen tile is an outline, and the button honours your situations (#349)
The practice page opens with one card: what kind of sitting, and the button
that starts it. Everything that tailors or explains follows.

A chosen tile or chip is no longer a solid black slab. One `choice` utility
draws every selection the same way: light at rest; a dark outline, a faint
tint and a check mark in the corner when chosen. The start button is the
only filled block on the screen. Used by the practice chooser, the
situations form, the session settings, the theme and language settings, the
vocabulary filters and the sector chips.

The start button used to practise everything whatever the learner had
chosen below it. Choosing a situation now takes effect as it is tapped, the
button starts from the chosen situations (`startScope`, with a test), and
one line under it says which it is: your situations, or everything.


Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-25 12:10:30 +01:00

29 lines
1.2 KiB
TypeScript

import assert from "node:assert/strict";
import { test } from "node:test";
import { SCENES } from "../../situations/display.ts";
import { focusOf } from "./focus.ts";
import { ALL } from "./scope.ts";
import { startScope } from "./start.ts";
const [a, b] = SCENES.map((s) => s.id);
test("the start button practises the learner's chosen situations", () => {
const start = startScope(ALL, "practice", focusOf([a, b]));
assert.equal(start.from, "focus");
assert.deepEqual(start.scope, { kind: "scenes", id: `${a},${b}` });
});
test("with nothing chosen it starts everything, and says so", () => {
assert.deepEqual(startScope(ALL, "practice", null), { scope: ALL, from: "all" });
assert.deepEqual(startScope(ALL, "practice", focusOf([])), { scope: ALL, from: "all" });
});
test("a page opened on one thing starts that thing, whatever was chosen", () => {
const topic = { kind: "topic", id: "no-preterite" } as const;
assert.deepEqual(startScope(topic, "practice", focusOf([a])), { scope: topic, from: "url" });
});
test("a test is never narrowed in the browser", () => {
assert.deepEqual(startScope(ALL, "test", focusOf([a, b])), { scope: ALL, from: "all" });
});