diff --git a/e2e/annotate.spec.ts b/e2e/annotate.spec.ts index 2e0f53d..3cb1413 100644 --- a/e2e/annotate.spec.ts +++ b/e2e/annotate.spec.ts @@ -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"); diff --git a/e2e/forks.spec.ts b/e2e/forks.spec.ts index 367dba6..2327480 100644 --- a/e2e/forks.spec.ts +++ b/e2e/forks.spec.ts @@ -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; diff --git a/e2e/panes3.spec.ts b/e2e/panes3.spec.ts index c455ddb..6999473 100644 --- a/e2e/panes3.spec.ts +++ b/e2e/panes3.spec.ts @@ -71,28 +71,33 @@ 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) => { - const r = el.getBoundingClientRect(); - const out: { x: number; y: number }[] = []; - for (let i = 1; i < 12; i++) - for (let j = 1; j < 12; j++) { - const x = r.left + (r.width * i) / 12; - 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 }); - } - return out; - }); - expect(spots.length, t).toBeGreaterThan(3); - for (const s of spots.slice(0, 6)) { - // Away first, so each click is a change. + /** 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++) + for (let j = 1; j < 12; j++) { + const x = r.left + (r.width * i) / 12; + 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: x - r.left, y: y - r.top }); + } + return out; + }); + 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.