Browser tests: nodes instead of documents; addresses by node id; /linkhere and /linkall

menu.spec.ts becomes nodes.spec.ts: standing on the library root, /n/<id> addresses through a
reload, Back and Forward (and an old /doc/ address), the jump box, a file imported into a node two
levels down with a link relative to its top, exported back the same and copied just after itself,
Move under… by key and by the menu (never under itself; the root offered first), history's f and r
on the node the reader is on, the offline round trip, the node routes over HTTP, and panes and
phone width.

The other specs open a tree by its titles (helpers openAt, openPage, visit: /n/<id>, hoisted in the
column as /doc/ was), make top-level sections from the library page instead of /new, scan with
/linkhere (and check its scope against /linkall's), and expect a section's head on every pane but
the first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Opus 5.5 committed 2026-11-17 01:49:22 -05:00
1 parent bed47c0c7a
commit c4d6856649
17 files changed
+584 -490

No files matched your search

+8 -6
View File
@@ -98,7 +98,7 @@ const near = (a: number, b: number, d = 1) => Math.abs(a - b) <= d;
/** Two colours alike, but for rounding (a colour at part strength, un-premultiplied, may differ by a unit or two). */
const alike = (a: number[] | null, b: number[] | null) => !!a && !!b && a.every((v, i) => Math.abs(v - b[i]) <= 3);
test("every kind of pane's title rule is drawn by the curve into it, in the pane's colour: pages, sections, articles and their sections", async ({ page }) => {
test("every kind of pane's title rule is drawn by the curve into it, in the pane's colour: nodes (a top-level one too), articles and their sections", async ({ page }) => {
await library(page);
for (const t of ["The tides", "Fixed points"]) await open(page, "Library", t);
const seen = new Set<string>();
@@ -127,7 +127,9 @@ test("every kind of pane's title rule is drawn by the curve into it, in the pane
await expect(page.locator(".wiki-pane .wiki-head .wsub")).toHaveCount(1);
await still(page);
await check();
expect([...seen].sort(), JSON.stringify((await lines(page)).map((l) => [l.kind, l.ruled, l.cls, l.folded, l.scrolled]))).toEqual(["article", "article section", "page", "section"]);
expect([...seen].sort(), JSON.stringify((await lines(page)).map((l) => [l.kind, l.ruled, l.cls, l.folded, l.scrolled]))).toEqual(["article", "article section", "section"]);
// A top-level node's pane is headed like any other: only the first pane is a page.
expect(await page.locator(".strip .pane:not(.root) > .pane-scroll > .pane-body > .top").count()).toBe(0);
// The two forks out of the library are two colours; the top node has none.
expect(await pane(page, "Library").getAttribute("data-hue")).toBeNull();
expect(await pane(page, "The tides").getAttribute("data-hue")).not.toBe(await pane(page, "Fixed points").getAttribute("data-hue"));
@@ -185,8 +187,8 @@ test("the join of a curve and the rule it runs into is one stroke, on device pix
await library(page);
for (const t of ["The tides", "What a proof is", "The invention of writing", "Fixed points"]) await open(page, "Library", t);
await open(page, "The tides", "The force");
// The focus to the last document, so The tides folds to its tab with its source out of sight.
await pane(page, "Fixed points").locator(".top h1").dispatchEvent("click");
// The focus to the last top-level pane, so The tides folds to its tab with its source out of sight.
await pane(page, "Fixed points").locator(".pane-head h2").dispatchEvent("click");
await still(page);
const ls = await lines(page);
const shot = pixels(await page.screenshot());
@@ -231,7 +233,7 @@ test("a pane folded or scrolled past its title shows its tab, and its curve land
await library(page);
for (const t of ["The tides", "What a proof is", "The invention of writing", "Fixed points"]) await open(page, "Library", t);
await open(page, "The tides", "The force");
await pane(page, "Fixed points").locator(".top h1").dispatchEvent("click");
await pane(page, "Fixed points").locator(".pane-head h2").dispatchEvent("click");
await still(page);
let ls = await lines(page);
let checked = 0;
@@ -242,7 +244,7 @@ test("a pane folded or scrolled past its title shows its tab, and its curve land
if (!l || l.cls.includes("lost") || l.focused) continue;
checked++;
const visible = await pane(page, t).evaluate((p) => {
const h = p.querySelector<HTMLElement>(".top h1")!.getBoundingClientRect();
const h = p.querySelector<HTMLElement>(".pane-head, .top h1")!.getBoundingClientRect();
const r = p.getBoundingClientRect();
const next = (p.nextElementSibling as HTMLElement | null)?.getBoundingClientRect().top ?? Infinity;
const covered = p.hasAttribute("data-covered") || p.hasAttribute("data-scrolled");