Tests: a dotted curve's end at a scrolled pane's tab; click points measured after each move; wait for an article before Tab

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-16 22:18:16 -05:00
1 parent 0df51493cd
commit 626dc19e1b
3 files changed
+18 -10

No files matched your search

+2
View File
@@ -162,6 +162,8 @@ test("an article's annotations show wherever it is opened: from another link, fr
await jump(page, "Recursion without names"); await jump(page, "Recursion without names");
await tabTo(page, "fixed-point combinator"); await tabTo(page, "fixed-point combinator");
await keys(page, "Enter"); await keys(page, "Enter");
// (Keys held while the article arrives act all at once: wait for it before Tab-ing through it.)
await expect(page.locator(".wiki-pane").last().locator(".wiki-text").first()).toBeVisible();
await tabTo(page, "lambda calculus"); await tabTo(page, "lambda calculus");
await keys(page, "Enter"); await keys(page, "Enter");
await expect(page.locator(".wiki-pane").last().locator(".wiki-head h2")).toHaveText("Lambda calculus"); await expect(page.locator(".wiki-pane").last().locator(".wiki-head h2")).toHaveText("Lambda calculus");
+2 -1
View File
@@ -326,7 +326,8 @@ test("a curve per open edge, from where each pane was opened to its title; it fo
await nextFrames(page); await nextFrames(page);
cs = await curves(page); cs = await curves(page);
expect(edge("Eukaryote", "Bacteria")[0].cls).toContain("lost"); expect(edge("Eukaryote", "Bacteria")[0].cls).toContain("lost");
const top = (await pane(page, "Eukaryote").locator(".pane-scroll").boundingBox())!.y; // (The pane, scrolled past its title, shows its tab: its edge is the tab's foot; the curve ends turned up toward the link.)
const top = (await pane(page, "Eukaryote").locator(".pane-scroll").boundingBox())!.y + 30;
expect(Math.abs(edge("Eukaryote", "Bacteria")[0].a.y - top)).toBeLessThan(6); expect(Math.abs(edge("Eukaryote", "Bacteria")[0].a.y - top)).toBeLessThan(6);
// Scroll the strip: the curves move with the panes. // Scroll the strip: the curves move with the panes.
const was = edge("Two kinds of cell", "Simple cells")[0].b; const was = edge("Two kinds of cell", "Simple cells")[0].b;
+14 -9
View File
@@ -71,9 +71,9 @@ test("a click anywhere in a pane that is not text, a row or a link makes that pa
await open(page, "Fixed points", "The idea itself"); await open(page, "Fixed points", "The idea itself");
for (const t of ["Library", "Fixed points", "The idea itself", "Library", "The idea itself", "Fixed points"]) { for (const t of ["Library", "Fixed points", "The idea itself", "Library", "The idea itself", "Fixed points"]) {
const p = pane(page, t); const p = pane(page, t);
const b = (await p.boundingBox())!; /** A grid of points over the pane; those that fall on nothing that acts. */
// A grid of points over the pane; those that fall on nothing that acts are clicked. const spots = () =>
const spots = await p.evaluate((el) => { p.evaluate((el) => {
const r = el.getBoundingClientRect(); const r = el.getBoundingClientRect();
const out: { x: number; y: number }[] = []; const out: { x: number; y: number }[] = [];
for (let i = 1; i < 12; i++) for (let i = 1; i < 12; i++)
@@ -82,17 +82,22 @@ test("a click anywhere in a pane that is not text, a row or a link makes that pa
const y = r.top + (r.height * j) / 12; const y = r.top + (r.height * j) / 12;
const hit = document.elementFromPoint(x, y) as HTMLElement | null; const hit = document.elementFromPoint(x, y) as HTMLElement | null;
if (!hit || !el.contains(hit) || hit.closest("[data-node], [data-row], a, button, [role=button], [data-more], [data-linking], [data-related], [data-target], [data-wrow], .pane-ctl, .grip, .tabline, .spine, [data-wtext], .lnk, .anchor")) continue; if (!hit || !el.contains(hit) || hit.closest("[data-node], [data-row], a, button, [role=button], [data-more], [data-linking], [data-related], [data-target], [data-wrow], .pane-ctl, .grip, .tabline, .spine, [data-wtext], .lnk, .anchor")) continue;
out.push({ x, y }); out.push({ x: x - r.left, y: y - r.top });
} }
return out; return out;
}); });
expect(spots.length, t).toBeGreaterThan(3); const n = (await spots()).length;
for (const s of spots.slice(0, 6)) { expect(n, t).toBeGreaterThan(3);
// Away first, so each click is a change. for (let k = 0; k < Math.min(6, n); k++) {
// Away first, so each click is a change; then the point, measured where the pane is now.
const other = t === "Library" ? "Fixed points" : "Library"; const other = t === "Library" ? "Fixed points" : "Library";
await pane(page, other).locator(".pane-head h2, .top h1").first().dispatchEvent("click"); await pane(page, other).locator(".pane-head h2, .top h1").first().dispatchEvent("click");
await page.mouse.click(s.x, s.y); await still(page);
await expect.poll(() => activeTitle(page), `${t} at ${Math.round(s.x - b.x)},${Math.round(s.y - b.y)}`).toBe(t); const s = (await spots())[k];
if (!s) continue;
const b = (await p.boundingBox())!;
await page.mouse.click(b.x + s.x, b.y + s.y);
await expect.poll(() => activeTitle(page), `${t} at ${Math.round(s.x)},${Math.round(s.y)}`).toBe(t);
} }
} }
// A selection goes on a click elsewhere: in another pane's margin, on the top bar, and with Esc. // A selection goes on a click elsewhere: in another pane's margin, on the top bar, and with Esc.