Public: anyone can read this; the crew can change it.

The forge toolbar in a preview names the pull it previews and links back to it #15865

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

torque/forge:torque/15850-the-forge-toolbar-in-a-preview-names-the → main 0 commits fork

  • Merged. torque/15850-the-forge-toolbar-in-a-preview-names-the was merged into main as a428737.

Review

Sign in to review this change.
14 files changed +123 −44
src/apps/proxy.ts +7 −4
@@ -458,15 +458,18 @@ export function pillWhere(
458458 }
459459 const number = /^pull-(\d+)$/.exec(target.env)?.[1];
460460 if (number === undefined) return where;
461 where.pull = Number(number);
461 // The number is read from the forge's own record: a preview host naming a pull the repository
462 // does not have says nothing.
463 const asked = Number(number);
464 const pull = getIssue(db, target.app.repoId, asked);
465 if (pull === undefined || pull.kind !== "pull") return where;
466 where.pull = asked;
462467 // Whether the panel offers the comment box or the way to sign in for it.
463468 if (user !== undefined) where.signedIn = true;
464469 // What a waiting guest's preview runs on is said to whoever looks at it: it is about the page in
465470 // front of them.
466 const row = getPull(db, target.app.repoId, where.pull);
471 const row = getPull(db, target.app.repoId, asked);
467472 if (row !== undefined && guestWaits(db, row)) where.waits = true;
468 const pull = getIssue(db, target.app.repoId, where.pull);
469 if (pull === undefined) return where;
470473 if (!reads || !mayView(db, repo, pull, user)) return where;
471474 where.title = pull.title;
472475 if (row !== undefined && row.headBranch !== "") where.branch = row.headBranch;
src/apps/toolbar.ts +1 −1
@@ -121,7 +121,7 @@ const toolbarSource = `(function () {
121121 }
122122 var cw = ${JSON.stringify(CHECK_WORDS)};
123123 var cv = d.check && Object.prototype.hasOwnProperty.call(cw, d.check) ? cw[d.check] : "";
124 var pt = "Pull #" + d.pull + (cv ? ": " : "");
124 var pt = "Preview of #" + d.pull + (cv ? ": " : "");
125125 // The word's own slot is as wide as the longest word: checking -> green never reflows the row.
126126 function slot(a) {
127127 if (!cv) return;
test/apps-pill-check.test.ts +6 −6
@@ -84,16 +84,16 @@ describe("the pill's check line", () => {
8484
8585 test("the panel script draws the line for a pull, never for production or an unknown key", () => {
8686 const pull = { app: "notes", env: "pull-3", pull: "3" };
87 // The word sits in its own slot, so it is its own text beside "Pull #3: ".
87 // The word sits in its own slot, so it is its own text beside "Preview of #3: ".
8888 const line = (set: Record<string, string>) => {
8989 const t = drawn(set);
90 const i = t.indexOf("Pull #3: ");
90 const i = t.indexOf("Preview of #3: ");
9191 return i < 0 ? null : `${t[i]}${t[i + 1]}`;
9292 };
93 expect(line({ ...pull, check: "failed" })).toBe(`Pull #3: ${CHECK_WORDS.failed}`);
94 expect(line({ ...pull, check: "cancelled" })).toBe("Pull #3: cancelled");
95 expect(drawn({ ...pull, check: "bogus" }).filter((t) => t.startsWith("Pull"))).toEqual(["Pull #3"]);
96 expect(drawn({ ...pull, check: "constructor" }).filter((t) => t.startsWith("Pull"))).toEqual(["Pull #3"]);
93 expect(line({ ...pull, check: "failed" })).toBe(`Preview of #3: ${CHECK_WORDS.failed}`);
94 expect(line({ ...pull, check: "cancelled" })).toBe("Preview of #3: cancelled");
95 expect(drawn({ ...pull, check: "bogus" }).filter((t) => t.startsWith("Preview"))).toEqual(["Preview of #3"]);
96 expect(drawn({ ...pull, check: "constructor" }).filter((t) => t.startsWith("Preview"))).toEqual(["Preview of #3"]);
9797 expect(drawn(pull).some((t) => /^(Checks|No checks)/.test(t))).toBe(false);
9898 // Production, even handed a check, names the app and says no check.
9999 const prod = drawn({ app: "notes", env: "production", check: "passed" });
test/apps-pill-freshness.test.ts +2 −2
@@ -269,14 +269,14 @@ describe("the pill's script draws the freshness line", () => {
269269 ];
270270 for (const [extra, said] of cases) {
271271 const lines = panelLines({ ...base, ...extra });
272 expect(lines.slice(0, 4)).toEqual(["site", "Pull #7", "Environment: preview", said]);
272 expect(lines.slice(0, 4)).toEqual(["site", "Preview of #7", "Environment: preview", said]);
273273 expect(lines.filter((l) => words.includes(l as never))).toEqual([said]);
274274 }
275275 });
276276
277277 test("the line follows the pull when there is no title", () => {
278278 const lines = panelLines({ ...base, title: "", state: "merged" });
279 expect(lines.slice(0, 4)).toEqual(["site", "Pull #7", "Environment: preview", FRESHNESS_WORDS.merged]);
279 expect(lines.slice(0, 4)).toEqual(["site", "Preview of #7", "Environment: preview", FRESHNESS_WORDS.merged]);
280280 });
281281
282282 test("merged and closed win over deploying and behind; deploying wins over behind", () => {
test/apps-toolbar.test.ts +3 −3
@@ -476,19 +476,19 @@ describe("the pill's keyboard and touch behaviour", () => {
476476
477477
478478 test("on a preview with a repo the pull line links to the pull; otherwise it is plain text", () => {
479 const a = tree({ app: "notes", repo: "alice/notes", pull: "12" }).lines.find((l) => l.textContent === "Pull #12")!;
479 const a = tree({ app: "notes", repo: "alice/notes", pull: "12" }).lines.find((l) => l.textContent === "Preview of #12")!;
480480 expect(a.tag).toBe("a");
481481 expect(a.href).toBe("https://forge.test/alice/notes/pulls/12");
482482 expect(a.style.cssText).toContain("min-height:44px");
483483 const prod = tree({ app: "notes", repo: "alice/notes", env: "production", pull: "12" });
484 expect(prod.lines.some((l) => l.textContent.startsWith("Pull #"))).toBe(false);
484 expect(prod.lines.some((l) => l.textContent.startsWith("Preview of #"))).toBe(false);
485485 expect(prod.lines.some((l) => l.textContent === "production")).toBe(true);
486486 // An unknown environment with no pull draws no environment line at all.
487487 const unknown = tree({ app: "notes", repo: "alice/notes", env: "staging" });
488488 expect(unknown.lines.some((l) => l.textContent === "production" || l.textContent.startsWith("preview"))).toBe(false);
489489 for (const bad of [{ pull: "12x" }, { pull: "../1" }, { pull: "1234567890" }, { repo: "" }]) {
490490 const t = tree({ app: "notes", repo: "alice/notes", pull: "12", ...bad });
491 const l = t.lines.find((x) => x.textContent.startsWith("Pull #"))!;
491 const l = t.lines.find((x) => x.textContent.startsWith("Preview of #"))!;
492492 expect(l.tag === "a").toBe(false);
493493 }
494494 });
test/lost-journey.test.ts +6 −6
@@ -234,7 +234,7 @@ describe("lost journey: where you are and three exits", () => {
234234 // One link to the pull's page: the Pull link, not a second "Home" beside it.
235235 expect(run.named("Home")).toBeUndefined();
236236
237 const pullLink = run.built.find((e) => e.tag === "a" && String(e.textContent).startsWith(`Pull #${pull}`))!;
237 const pullLink = run.built.find((e) => e.tag === "a" && String(e.textContent).startsWith(`Preview of #${pull}`))!;
238238 expect(focusable(pullLink)).toBe(true);
239239 expect(pullLink.href).toBe(`${origin}/alice/public/pulls/${pull}`);
240240
@@ -266,7 +266,7 @@ describe("lost journey: where you are and three exits", () => {
266266 const run = await boot(html.replace(/data-repo="[^"]*"/, `data-repo="${repo}"`), await crewOf(host, cookie), `http://${host}/`);
267267 const hrefs = run.built.filter((e) => e.tag === "a").map((e) => String(e.href ?? ""));
268268 expect(hrefs.some((h) => h.includes("/../") || /\/x$/.test(h) && !h.includes("/alice/"))).toBe(false);
269 expect(run.built.some((e) => e.tag === "a" && String(e.textContent).startsWith("Pull #"))).toBe(false);
269 expect(run.built.some((e) => e.tag === "a" && String(e.textContent).startsWith("Preview of #"))).toBe(false);
270270 }
271271 });
272272
@@ -276,7 +276,7 @@ describe("lost journey: where you are and three exits", () => {
276276 const html = await (await ask(host, "/", cookie)).text();
277277 const run = await boot(html, await crewOf(host, cookie), `http://${host}/`);
278278 expect(run.named("production")).toBeDefined();
279 expect(run.built.some((e) => String(e.textContent).startsWith("Pull #"))).toBe(false);
279 expect(run.built.some((e) => String(e.textContent).startsWith("Preview of #"))).toBe(false);
280280 expect(run.named("Home")!.href).toBe(`${new URL(servers.url).origin}/alice/public`);
281281 });
282282
@@ -289,7 +289,7 @@ describe("lost journey: where you are and three exits", () => {
289289 expect(tag[2]).toContain(` data-env="pull-${pull}"`);
290290 expect(tag[2]).toContain(` data-pull="${pull}"`);
291291 const run = await boot(html, await crewOf(host), `http://${host}/`);
292 expect(run.built.find((e) => e.tag === "a" && String(e.textContent).startsWith(`Pull #${pull}`))!.href).toBe(`${new URL(servers.url).origin}/alice/public/pulls/${pull}`);
292 expect(run.built.find((e) => e.tag === "a" && String(e.textContent).startsWith(`Preview of #${pull}`))!.href).toBe(`${new URL(servers.url).origin}/alice/public/pulls/${pull}`);
293293 expect(run.named("Home")).toBeUndefined();
294294 expect(run.named("Tell the crew")).toBeUndefined();
295295 // Comment goes to the forge's own page, which asks the stranger to sign in there.
@@ -357,7 +357,7 @@ describe("lost journey: where you are and three exits", () => {
357357 const session = await ownerSession();
358358 expect(session).toContain("=");
359359 // The way back is the pull's page on a preview (the Pull link), else the app's (Home).
360 const back = preview ? run.built.find((e) => e.tag === "a" && String(e.textContent).startsWith(`Pull #${pull}`))! : run.named("Home")!;
360 const back = preview ? run.built.find((e) => e.tag === "a" && String(e.textContent).startsWith(`Preview of #${pull}`))! : run.named("Home")!;
361361 expect(new URL(back.href as string).pathname).toBe(preview ? `/alice/public/pulls/${pull}` : "/alice/public");
362362 expect(Boolean(run.named("Home"))).toBe(!preview);
363363 expect((await follow(back.href as string, session)).status).toBe(200);
@@ -370,7 +370,7 @@ describe("lost journey: where you are and three exits", () => {
370370
371371 const strangerHtml = await (await ask(host, "/")).text();
372372 const stranger = await boot(strangerHtml, await crewOf(host), `http://${host}/page`);
373 const strangerBack = preview ? stranger.built.find((e) => e.tag === "a" && String(e.textContent).startsWith(`Pull #${pull}`))! : stranger.named("Home")!;
373 const strangerBack = preview ? stranger.built.find((e) => e.tag === "a" && String(e.textContent).startsWith(`Preview of #${pull}`))! : stranger.named("Home")!;
374374 expect(new URL(strangerBack.href as string).pathname).toBe(preview ? `/alice/public/pulls/${pull}` : "/alice/public");
375375 expect((await follow(strangerBack.href as string)).status).toBe(200);
376376 });
test/toolbar-back.test.ts +2 −2
@@ -55,13 +55,13 @@ test("on production Home is the app's page on the forge, from the stored repo",
5555
5656 test("on a pull preview the Pull link is the pull's page", () => {
5757 const data = { repo: "trevato/lab", env: "preview", pull: "15657" };
58 expect(homeFor(data, "Pull #")).toBe("https://forge.test/trevato/lab/pulls/15657");
58 expect(homeFor(data, "Preview of #")).toBe("https://forge.test/trevato/lab/pulls/15657");
5959 });
6060
6161 test("a repo id with a dots-only segment never builds a link", () => {
6262 for (const repo of ["../x", "x/..", "../..", "./x"]) {
6363 expect(homeFor({ repo, env: "production" })).toBe("https://forge.test/elsewhere");
64 expect(homeFor({ repo, env: "preview", pull: "7" }, "Pull #")).toBeUndefined();
64 expect(homeFor({ repo, env: "preview", pull: "7" }, "Preview of #")).toBeUndefined();
6565 }
6666 });
6767
test/toolbar-check.test.ts +9 −9
@@ -1,7 +1,7 @@
11 /**
22 * The preview toolbar's pull line says green, red or checking from the pull's stored check run, and
3 * plain "Pull #N" when it has none. Already true on main (#14060); this proves it end to end: the
4 * stored run row, then the word (#14858).
3 * plain "Preview of #N" when it has none. Already true on main (#14060); this proves it end to end:
4 * the stored run row, then the word (#14858).
55 */
66 import { Database } from "bun:sqlite";
77 import { expect, test } from "bun:test";
@@ -37,7 +37,7 @@ function row(check: PillCheck | undefined): { text: string; slot?: any } {
3737 const win: any = { location: { origin: "https://app.test", pathname: "/" }, addEventListener() {}, matchMedia: () => ({ matches: false }) };
3838 new Function("window", "document", "location", "localStorage", "fetch", "URL", "setTimeout", "setInterval", "requestAnimationFrame", toolbarJs)(
3939 win, doc, win.location, { getItem: () => null, setItem() {} }, () => new Promise(() => {}), URL, () => 0, () => 0, () => 0);
40 const link = made.find((e) => /^Pull #\d+/.test(e.textContent));
40 const link = made.find((e) => /^Preview of #\d+/.test(e.textContent));
4141 return { text: link.textContent, slot: made.find((e) => e.tag === "span" && e.textContent === CHECK_WORDS[check as PillCheck]) };
4242 }
4343 const word = (check: PillCheck | undefined) => row(check).text;
@@ -46,9 +46,9 @@ test("stored ok, failed and running runs read green, red and checking", () => {
4646 const d = db();
4747 for (const [i, s] of ["ok", "failed", "running"].entries())
4848 d.run(`INSERT INTO run (kind, issue_id, commit_oid, state) VALUES ('check', ?, 'abc', ?)`, [`p${i}`, s]);
49 expect(word(pillCheck(d, "p0", "abc"))).toBe("Pull #12: green");
50 expect(word(pillCheck(d, "p1", "abc"))).toBe("Pull #12: red");
51 expect(word(pillCheck(d, "p2", "abc"))).toBe("Pull #12: checking");
49 expect(word(pillCheck(d, "p0", "abc"))).toBe("Preview of #12: green");
50 expect(word(pillCheck(d, "p1", "abc"))).toBe("Preview of #12: red");
51 expect(word(pillCheck(d, "p2", "abc"))).toBe("Preview of #12: checking");
5252 });
5353
5454 test("the newest run of the head wins; another commit's run is not read", () => {
@@ -57,10 +57,10 @@ test("the newest run of the head wins; another commit's run is not read", () =>
5757 expect(pillCheck(d, "p", "abc")).toBe("passed");
5858 });
5959
60 test("a pull with no check run says no check yet, and the pill draws plain Pull #N when none is sent", () => {
60 test("a pull with no check run says no check yet, and the pill draws plain Preview of #N when none is sent", () => {
6161 expect(pillCheck(db(), "p", "abc")).toBe("none");
62 expect(word("none")).toBe("Pull #12: no check yet");
63 expect(word(undefined)).toBe("Pull #12");
62 expect(word("none")).toBe("Preview of #12: no check yet");
63 expect(word(undefined)).toBe("Preview of #12");
6464 });
6565
6666 test("the word sits in a slot as wide as the longest word, the same for every state", () => {
test/toolbar-injection.test.ts +1 −1
@@ -86,6 +86,6 @@ test("the pill overlays the page: fixed, out of flow, in a shadow root", () => {
8686 });
8787
8888 test("on a preview the pill links to the pull's forge page in plain words", () => {
89 expect(toolbarJs).toContain('"Pull #"');
89 expect(toolbarJs).toContain('"Preview of #"');
9090 expect(toolbarJs).toContain('"/pulls/"');
9191 });
test/toolbar-preview.test.ts added +76
@@ -0,0 +1,76 @@
1 /**
2 * On a preview the toolbar reads "Preview of #N" and links to the pull; on production it reads as
3 * before. The number comes from the forge's record of the pull, never from the host alone.
4 */
5 import { afterAll, beforeAll, expect, test } from "bun:test";
6 import { mkdtemp, rm } from "node:fs/promises";
7 import { tmpdir } from "node:os";
8 import { join } from "node:path";
9 import { createApp, type App } from "../src/app.ts";
10 import { newApp } from "../src/actions/apps.ts";
11 import { createIssue } from "../src/core/issues.ts";
12 import { createUser } from "../src/core/users.ts";
13 import type { EnvName } from "../src/apps/data.ts";
14 import type { GrantWho } from "../src/apps/grants.ts";
15 import { getAppByRepo, type AppRecord } from "../src/core/apps.ts";
16 import { pillWhere, type AppTarget } from "../src/apps/proxy.ts";
17 import type { AppsRuntime } from "../src/apps/runtime.ts";
18 import { boot } from "./helpers/toolbar-boot.ts";
19 import { toolbarTag } from "../src/apps/toolbar.ts";
20
21 let dir: string;
22 let app: App;
23 let record: AppRecord;
24 let number: number;
25 let aliceId: string;
26 const who = (): GrantWho => ({ id: aliceId, name: "alice", role: "admin" });
27 const at = (env: EnvName): AppTarget => ({ app: record, env });
28 const runtime = () => ({ app }) as unknown as AppsRuntime;
29
30 beforeAll(async () => {
31 dir = await mkdtemp(join(tmpdir(), "forge-toolbar-preview-"));
32 app = createApp({ dataDir: dir, port: 0, host: "forge.test" });
33 const u = await createUser(app.db, {
34 origin: "seed", trusted: true, username: "alice", email: "[email protected]",
35 password: "a-good-passphrase", adminIfFirst: true,
36 });
37 if (!u.ok) throw new Error(u.error);
38 aliceId = u.value.id;
39 const made = await newApp(app, u.value, { name: "open", description: "x", visibility: "public" });
40 if (!made.ok) throw new Error(String(made.error));
41 const repoId = made.value.repo.id;
42 record = getAppByRepo(app.db, repoId)!;
43 const p = createIssue(app.db, { repoId, authorId: u.value.id, title: "t", kind: "pull" });
44 if (!p.ok) throw new Error(p.error);
45 app.db.run("INSERT INTO pull (issue_id, base_branch, head_branch, base_oid, head_oid) VALUES (?1, 'main', 'topic', ?2, ?2)", [p.value.id, "b".repeat(40)]);
46 number = p.value.number;
47 }, 120_000);
48
49 afterAll(async () => {
50 app.close();
51 await rm(dir, { recursive: true, force: true });
52 });
53
54 test("a preview of a recorded pull carries its number; the panel reads Preview of #N and links to it", () => {
55 const w = pillWhere(runtime(), at(`pull-${number}`), who());
56 expect(w.pull).toBe(number);
57 const tag = toolbarTag("https://forge.test", w);
58 expect(tag).toContain(`data-pull="${number}"`);
59 const texts = boot(null, 400, 800, { app: "open", repo: w.repo!, env: `pull-${number}`, pull: String(number) }).texts();
60 expect(texts).toContain(`Preview of #${number}`);
61 });
62
63 test("a host naming a pull the record does not have shows nothing", () => {
64 const w = pillWhere(runtime(), at("pull-9999"), who());
65 expect(w.pull).toBeUndefined();
66 const texts = boot(null, 400, 800, { app: "open", env: "pull-9999" }).texts();
67 expect(texts.some((t) => t.startsWith("Preview of"))).toBe(false);
68 });
69
70 test("production reads as before", () => {
71 const w = pillWhere(runtime(), at("production"), who());
72 expect(w.pull).toBeUndefined();
73 const texts = boot(null, 400, 800, { app: "open", env: "production" }).texts();
74 expect(texts).toContain("production");
75 expect(texts.some((t) => t.startsWith("Preview of"))).toBe(false);
76 });
test/toolbar-pull-label.test.ts +2 −2
@@ -31,12 +31,12 @@ function run(markup: string) {
3131 const win: any = { location: { origin: "https://app.test", pathname: "/" }, addEventListener() {}, matchMedia: () => ({ matches: false }) };
3232 new Function("window", "document", "location", "localStorage", "fetch", "URL", "setTimeout", "setInterval", "requestAnimationFrame", toolbarJs)(
3333 win, doc, win.location, { getItem: () => null, setItem() {} }, () => new Promise(() => {}), URL, () => 0, () => 0, () => 0);
34 return made.find((e) => e.tag === "a" && e.textContent.startsWith("Pull #"));
34 return made.find((e) => e.tag === "a" && e.textContent.startsWith("Preview of #"));
3535 }
3636
3737 test("the pull link carries the title as a one-line text child", () => {
3838 const link = run(html("Add lists"));
39 expect(link.textContent).toBe("Pull #12");
39 expect(link.textContent).toBe("Preview of #12");
4040 const t = link.children.find((c: any) => c.textContent === "Add lists");
4141 expect(t.tag).toBe("span");
4242 expect(t.style.cssText).toContain("white-space:nowrap");
test/toolbar-pull-state.test.ts +5 −5
@@ -31,13 +31,13 @@ function line(markup: string): { textContent: string; href?: string } | undefine
3131 const win: any = { location: { origin: "https://app.test", pathname: "/" }, addEventListener() {}, matchMedia: () => ({ matches: false }) };
3232 new Function("window", "document", "location", "localStorage", "fetch", "URL", "setTimeout", "setInterval", "requestAnimationFrame", toolbarJs)(
3333 win, doc, win.location, { getItem: () => null, setItem() {} }, (u: string) => { calls.fetch.push(String(u)); return new Promise(() => {}); }, URL, () => 0, () => { calls.setInterval++; return 0; }, () => 0);
34 return made.find((e) => /^Pull #\d+/.test(e.textContent));
34 return made.find((e) => /^Preview of #\d+/.test(e.textContent));
3535 }
3636
3737 for (const [check, word] of [["running", "checking"], ["passed", "green"], ["failed", "red"]] as const) {
38 test(`${check} reads "Pull #12: ${word}" and links to the pull`, () => {
38 test(`${check} reads "Preview of #12: ${word}" and links to the pull`, () => {
3939 const l = line(tag(check));
40 expect(l!.textContent).toBe(`Pull #12: ${word}`);
40 expect(l!.textContent).toBe(`Preview of #12: ${word}`);
4141 expect(l!.href).toBe("https://forge.test/alice/notes/pulls/12");
4242 });
4343 }
@@ -58,11 +58,11 @@ test("drawing the line neither polls nor fetches the pull's state", () => {
5858 test("a hostile state is escaped in the tag and draws no state word", () => {
5959 const out = tag(`"><img src=x>`);
6060 expect(out).not.toContain(`"><img`);
61 expect(line(out)!.textContent).toBe("Pull #12");
61 expect(line(out)!.textContent).toBe("Preview of #12");
6262 });
6363
6464 test("one link names the pull, and no separate checks row is drawn", () => {
6565 const rows = (() => { const out = tag("passed"); return out; })();
66 expect(line(rows)!.textContent).toBe("Pull #12: green");
66 expect(line(rows)!.textContent).toBe("Preview of #12: green");
6767 expect(toolbarJs).not.toContain("Checks passed");
6868 });
test/toolbar-pull.test.ts +2 −2
@@ -26,7 +26,7 @@ function lines(markup: string): { tag: string; textContent: string; href?: strin
2626 const win: any = { location: { origin: "https://app.test", pathname: "/" }, addEventListener() {}, matchMedia: () => ({ matches: false }) };
2727 new Function("window", "document", "location", "localStorage", "fetch", "URL", "setTimeout", "setInterval", "requestAnimationFrame", toolbarJs)(
2828 win, doc, win.location, { getItem: () => null, setItem() {} }, () => new Promise(() => {}), URL, () => 0, () => 0, () => 0);
29 return made.filter((e) => e.textContent.startsWith("Pull #"));
29 return made.filter((e) => e.textContent.startsWith("Preview of #"));
3030 }
3131
3232 test("a preview response carries the pull number and a link to the pull", () => {
@@ -34,7 +34,7 @@ test("a preview response carries the pull number and a link to the pull", () =>
3434 expect(out).toContain('data-pull="12"');
3535 const [link] = lines(out);
3636 expect(link!.tag).toBe("a");
37 expect(link!.textContent).toBe("Pull #12");
37 expect(link!.textContent).toBe("Preview of #12");
3838 expect(link!.href).toBe("https://forge.test/alice/notes/pulls/12");
3939 });
4040
test/toolbar-where.test.ts +1 −1
@@ -157,7 +157,7 @@ const form = (made: any[]) => made.find((e) => e.tag === "form" && e.listeners.s
157157
158158 test("the preview's panel names the pull with its title, linked, and has one comment form once opened", () => {
159159 const { made, open } = panel(preview);
160 const link = made.find((e) => e.tag === "a" && e.textContent === "Pull #1");
160 const link = made.find((e) => e.tag === "a" && e.textContent === "Preview of #1");
161161 expect(link.href).toBe("https://forge.test/alice/notes/pulls/1");
162162 // The form is not in the pill: a closed panel has fetched nothing for it.
163163 expect(made.some((e) => e.tag === "textarea" && e.rows === 2)).toBe(false);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs