Tests: a link's curve starts with its underline; the busy forest opened by places, not titles other tests rename
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
e77b9ba073
commit
ead9c0347d
2 files changed
+18
-6
No files matched your search
+3
-2
@@ -294,10 +294,11 @@ test("a curve per open edge, from where each pane was opened to its title; it fo
|
||||
expect(p.y).toBeLessThan(r.y + r.height + slack);
|
||||
};
|
||||
await nearIn(kinds.locator(".lnk", { hasText: "Eukaryotes" }), edge("Two kinds of cell", "Eukaryote")[0].a);
|
||||
// From words, the curve starts at the right end of their underline (a short step joins it to the lead-out in the gap below).
|
||||
// From words, the curve starts with their underline (it draws it, from their left), then a short step down to the lead-out in the gap below.
|
||||
const link = (await kinds.locator(".lnk", { hasText: "Eukaryotes" }).first().boundingBox())!;
|
||||
const start = edge("Two kinds of cell", "Eukaryote")[0].a;
|
||||
expect(Math.abs(start.x - (link.x + link.width))).toBeLessThan(2);
|
||||
// (It starts with the link's underline, which it draws, from the link's left.)
|
||||
expect(Math.abs(start.x - link.x)).toBeLessThan(2);
|
||||
expect(start.y).toBeGreaterThan(link.y + link.height - 9);
|
||||
expect(start.y).toBeLessThan(link.y + link.height);
|
||||
await nearIn(kinds.locator(".node.forked > .row", { hasText: "Simple cells" }), edge("Two kinds of cell", "Simple cells")[0].a);
|
||||
|
||||
+15
-4
@@ -22,9 +22,19 @@ async function still(page: Page) {
|
||||
await frames(page);
|
||||
}
|
||||
async function open(page: Page, inPane: string | RegExp, text: string | RegExp, sel = ".row") {
|
||||
await pane(page, inPane).locator(sel, { hasText: text }).first().dispatchEvent("click");
|
||||
// A row by its exact title (the shared library has documents whose titles start the same).
|
||||
const it = sel === ".row" && typeof text === "string" ? pane(page, inPane).locator(".row", { has: page.locator(`.title:text-is("${text}")`) }) : pane(page, inPane).locator(sel, { hasText: text });
|
||||
await it.first().dispatchEvent("click");
|
||||
await still(page);
|
||||
}
|
||||
/** Open the nth row of a pane's own outline; returns its title. */
|
||||
async function openNth(page: Page, inPane: string, n: number): Promise<string> {
|
||||
const row = pane(page, inPane).locator(":scope > .pane-scroll > .pane-body > .outline > li > .row").nth(n);
|
||||
const title = (await row.locator(".title").first().textContent())!.trim();
|
||||
await row.dispatchEvent("click");
|
||||
await still(page);
|
||||
return title;
|
||||
}
|
||||
async function library(page: Page) {
|
||||
await autoLayout(page);
|
||||
await page.goto("/");
|
||||
@@ -42,9 +52,10 @@ async function forest(page: Page) {
|
||||
await open(page, "Expansion by depth", "Levels of a node");
|
||||
await open(page, "Expansion by depth", "Generation on demand");
|
||||
await open(page, "Library", "The tides");
|
||||
await open(page, "The tides", "The force");
|
||||
await open(page, "The force", "Why two bulges");
|
||||
await open(page, "The force", "Why the Moon beats the Sun");
|
||||
// (By their places, not their titles: other tests rename sections of the shared library.)
|
||||
const sec = await openNth(page, "The tides", 1);
|
||||
await openNth(page, sec, 0);
|
||||
await openNth(page, sec, 1);
|
||||
await pane(page, "Generation on demand").locator(".pane-head h2").dispatchEvent("click");
|
||||
await still(page);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user