Skip to content

Test suite, difficulty filter, and playback focus fix - #29

Merged
tornike14 merged 11 commits into
mainfrom
develop
Sep 20, 2026
Merged

tornike14 merged 11 commits into
mainfrom
develop

Conversation

@tornike14

Copy link
Copy Markdown
Owner

Summary

  • Add a Vitest suite (jsdom, React Testing Library) covering registries, metadata, sitemap and robots, sandbox parser and generators, stores, hooks, and shared primitives, plus a convention sweep across every topic. CI now runs it on Node 22.
  • Move the step audit rules into scripts/lib/stepAudit.ts so they are unit tested and reused by the convention suite.
  • Harden registry lookups against prototype keys and validate stored topic progress.
  • Add a difficulty filter to category pages, kept in the level query parameter with pages staying fully static.
  • Drop focus from a clicked sidebar link when a playback shortcut fires, so the first arrow key no longer paints a focus ring on it.
  • Consolidate topic routes and shared primitives from the earlier develop commits.

Verification

  • npm run verify passes: lint, typecheck, format check, 667 tests, step audit, production build.
  • CI is green on every develop commit in this range.

Replace per-topic page files with a single [category]/[topic] route driven by
the topic registry, add the shared visualization primitives (toolbar, example
picker, source panel, explanation toggle, flow connector), the step audit
script, and the docs and skills that describe them.

Content review fixes:
- Garbage collection: rewrite the forgotten timer example so the leak is real
  (closure over a local that outlives its frame, not a nulled binding)
- Modules: circular import example uses var and explains the let/const TDZ case
- Debounce/throttle: a wrapper recreated per render fires too often, it does
  not stop firing
- Context: memoize the consumer re-render example so the parent re-render
  does not mask the context effect
- Hooks, virtual DOM, suspense, server components, concurrent rendering,
  Angular, type coercion, scope chain: wording and accuracy corrections
- Remove hidden em dashes from promises and generators

Playback: reset the step index synchronously when the example changes and
derive the playing flag so playback stops at the last step without a
setState inside the effect.
Set up Vitest with jsdom and React Testing Library, covering the topic
and category registries, metadata, sitemap and robots, the sandbox
parser and generators, the progress and explanation stores, shared
hooks, and the shared visualization primitives. A convention suite
sweeps every topic for folder shape, step data, and copy rules.

Move the step audit rules into scripts/lib/stepAudit.ts so they can be
unit tested and reused by the convention suite.

Harden registry lookups against prototype keys with Object.hasOwn, and
validate stored topic progress so non-object JSON falls back to an
empty map.

CI now runs the suite on Node 22 between the format check and the step
audit. Document the setup in docs/testing.md.
Category pages get All, Beginner, Intermediate, and Advanced chips with a
count per level. The selected level lives in the level query parameter so
a filtered view can be shared, written with replaceState so it adds no
history entries. Pages stay static: the server render lists every topic
and the URL value is applied after hydration through useSyncExternalStore.

Levels with no topics in a category render disabled rather than hidden,
empty groups collapse, and filtered cards keep their registry index.
A sidebar link clicked with the mouse keeps focus after navigation, so the
first arrow key painted the focus ring on it. Playback shortcuts now blur a
focused link before acting; buttons and inputs keep their focus.
@vercel

vercel Bot commented Sep 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
visualizejs Ready Ready Preview Sep 20, 2026 12:59am UTC

@tornike14
tornike14 merged commit ed89a5f into main Sep 20, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — 21e02817 Deployed Sep 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant