Skip to content

Demo: one-click preset contrasts for the candidate CRS lookup - #10

Merged
kochizufan merged 1 commit into
train/2026-12from
dec26/m1-t11c-presets
Oct 27, 2026
Merged

kochizufan merged 1 commit into
train/2026-12from
dec26/m1-t11c-presets

Conversation

@kochizufan

Copy link
Copy Markdown
Member

Summary

Adds a preset bar to demo/crs-candidate-lookup.html with three A/B contrasts whose results differ clearly:

Preset A B What splits
place Kyoto extent Tokyo extent Plane rectangular systems: VI (EPSG:6674) + historical grid zone B vs VIII/IX (EPSG:6676, EPSG:6677) + zone A
historical-grid Kyoto, custom projections off Kyoto, custom projections on Only B has UTJCP:ZONE-B; one more row
area-filter Kyoto, area filter Japan Kyoto, no area filter B lists CRSs outside Japan and many more rows; going back to A restores the A list

Pressing a button fills in the extent and filters, puts the markers on the extent corners, fits the map, runs one lookup, highlights the button (aria-pressed) and shows a one-line description of what should be visible. The existing controls keep working afterwards.

Also:

  • demo/main.js exports initDemo({ runtime, doc }); the page starts it (no side effects on import).
  • Next to the result count: the number of candidates whose area name does not mention Japan, and the number of excluded rows.
  • Footer shows the @c4h/atlas version.
  • Preset values live only in demo/presets.js; the page and the tests import the same data.

Tests

  • tests/demo-presets.test.ts (real engine): each contrast splits as described, including four lookups in a row with and without the area filter and an A → B → A round trip (60 s limit per call).
  • tests/demo-wiring.test.ts (jsdom, stub runtime, real page HTML): each button calls the lookup exactly once with the preset arguments, sets aria-pressed, shows the matching description; the defaults before any preset are unchanged.
  • jsdom added as a dev dependency. Test files now run one at a time (fileParallelism: false) because the proj-wasm worker pools of several engine test files competed for memory and hit timeouts.

Local: pnpm run test (22 files / 131 tests), typecheck, build, verify:demo, verify:packed-browser all exit 0; dist unchanged; pnpm pack --dry-run lists no demo/ and no jsdom. Checked in a real browser: Kyoto 11 / Tokyo 15 candidates, 10 / 11 without / with custom projections, 11 / 168 / 11 for the area filter round trip.

🤖 Generated with Claude Code

Add a preset bar with three A/B contrasts (place, historical-grid,
area-filter). Each button fills in the extent and filters, moves the
markers to the extent corners, fits the map, runs one lookup, and shows a
one-line description of what should be visible. Preset values live only in
demo/presets.js, which both the page and the tests import.

- demo/main.js now exports initDemo({ runtime, doc }); the page starts it.
- Show the number of candidates whose area name does not mention Japan and
  the number of excluded rows next to the result count.
- Show the @c4h/atlas version in the footer.
- tests/demo-presets.test.ts checks with the real engine that each contrast
  splits, including repeated lookups with and without the area filter.
- tests/demo-wiring.test.ts (jsdom) checks that each button calls the
  lookup once with the preset arguments and that the defaults are unchanged.
- Add jsdom as a dev dependency and run test files one at a time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kochizufan
kochizufan marked this pull request as ready for review October 27, 2026 13:51
@kochizufan
kochizufan merged commit 340977a into train/2026-12 Oct 27, 2026
5 checks passed
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