Public: anyone can read this; the crew can change it.
small: `?` lists the keys on /flow and /system, and `esc` closes it #10758
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/10747-small-lists-the-keys-on-flow-and-system → main 1 commit fork
1 file
changed +32
−0
test/flow-system-keys.test.ts added +32
| @@ -0,0 +1,32 @@ | ||
| 1 | /** `?` lists the keys on /flow and /system, from the shared shell, not a copy (#10747). */ | |
| 2 | import { afterAll, beforeAll, expect, test } from "bun:test"; | |
| 3 | import { snappyFixture, type SnappyFixture } from "../bench/snappy.ts"; | |
| 4 | ||
| 5 | let f: SnappyFixture; | |
| 6 | beforeAll(async () => { | |
| 7 | f = await snappyFixture(); | |
| 8 | }, 120_000); | |
| 9 | afterAll(async () => { | |
| 10 | await f.close(); | |
| 11 | }); | |
| 12 | ||
| 13 | const get = async (path: string) => (await fetch(`${f.base}${path}`, { headers: { cookie: f.ownerCookie } })).text(); | |
| 14 | const shellSrc = (html: string) => /<script src="(\/assets\/shell-[^"]+\.js)" defer>/.exec(html)?.[1]; | |
| 15 | ||
| 16 | for (const path of ["/flow", "/system"]) { | |
| 17 | test(`${path}: the key list is in the markup and the keys script is the shared shell`, async () => { | |
| 18 | const html = await get(path); | |
| 19 | // The same dialog and words as every other page: a closed <dialog>, so opening it moves nothing. | |
| 20 | expect(html).toContain('<dialog class="dialog" id="help-dialog"'); | |
| 21 | expect(html).toContain("Keyboard shortcuts"); | |
| 22 | expect(html).toContain("data-help-body"); | |
| 23 | // The very same shell asset as another page that has the list, and no copy inline. | |
| 24 | const src = shellSrc(html); | |
| 25 | expect(src).toBeDefined(); | |
| 26 | expect(shellSrc(await get("/boards"))).toBe(src); | |
| 27 | expect(html).not.toContain("openHelp"); | |
| 28 | const js = await (await fetch(`${f.base}${src}`)).text(); | |
| 29 | expect(js).toContain("e.key === '?'"); | |
| 30 | expect(js).toContain("help-dialog"); | |
| 31 | }); | |
| 32 | } |