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:
1 parent
0df51493cd
commit
626dc19e1b
3 files changed
+18
-10
No files matched your search
@@ -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 tabTo(page, "fixed-point combinator");
|
||||
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 keys(page, "Enter");
|
||||
await expect(page.locator(".wiki-pane").last().locator(".wiki-head h2")).toHaveText("Lambda calculus");
|
||||
|
||||
+2
-1
@@ -326,7 +326,8 @@ test("a curve per open edge, from where each pane was opened to its title; it fo
|
||||
await nextFrames(page);
|
||||
cs = await curves(page);
|
||||
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);
|
||||
// Scroll the strip: the curves move with the panes.
|
||||
const was = edge("Two kinds of cell", "Simple cells")[0].b;
|
||||
|
||||
+14
-9
@@ -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");
|
||||
for (const t of ["Library", "Fixed points", "The idea itself", "Library", "The idea itself", "Fixed points"]) {
|
||||
const p = pane(page, t);
|
||||
const b = (await p.boundingBox())!;
|
||||
// A grid of points over the pane; those that fall on nothing that acts are clicked.
|
||||
const spots = await p.evaluate((el) => {
|
||||
/** A grid of points over the pane; those that fall on nothing that acts. */
|
||||
const spots = () =>
|
||||
p.evaluate((el) => {
|
||||
const r = el.getBoundingClientRect();
|
||||
const out: { x: number; y: number }[] = [];
|
||||
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 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;
|
||||
out.push({ x, y });
|
||||
out.push({ x: x - r.left, y: y - r.top });
|
||||
}
|
||||
return out;
|
||||
});
|
||||
expect(spots.length, t).toBeGreaterThan(3);
|
||||
for (const s of spots.slice(0, 6)) {
|
||||
// Away first, so each click is a change.
|
||||
const n = (await spots()).length;
|
||||
expect(n, t).toBeGreaterThan(3);
|
||||
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";
|
||||
await pane(page, other).locator(".pane-head h2, .top h1").first().dispatchEvent("click");
|
||||
await page.mouse.click(s.x, s.y);
|
||||
await expect.poll(() => activeTitle(page), `${t} at ${Math.round(s.x - b.x)},${Math.round(s.y - b.y)}`).toBe(t);
|
||||
await still(page);
|
||||
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.
|
||||
|
||||
Reference in new issue
Block a user