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

A pull's looks show the before and after pairs on a real pull, and say why when main has no picture of a page #9737

Merged opened this

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

Merged

scout/forge:scout/9733-a-pull-s-looks-show-the-before-and-after → main 2 commits fork

  • Merged. scout/9733-a-pull-s-looks-show-the-before-and-after was merged into main as 8884201.

Review

Sign in to review this change.
2 files changed +19 −2
src/web/pages/looks.ts +5 −2
@@ -226,8 +226,11 @@ export function lookCard(
226226 const compare = (before: readonly Look[], after: readonly Look[]): Html =>
227227 before.length === 0
228228 ? html`<div class="looks">
229 ${after.map((l) => picture(l, l.kind, page))}
230 </div>`
229 ${after.map((l) => picture(l, l.kind, page))}
230 </div>
231 <p class="muted small" data-no-main>
232 main has no picture of ${page === DEFAULT_PAGE ? "this page" : page} yet.
233 </p>`
231234 : html`<div class="looks" data-compare>
232235 <div>
233236 <p class="muted small">main</p>
test/pull-looks-pair.test.ts +14
@@ -19,6 +19,7 @@ let dataDir: string;
1919 let app: App;
2020 let servers: Servers;
2121 let page = "";
22 let pullNumber = 0;
2223 const MAIN = "b".repeat(40);
2324 const HEAD = "c".repeat(40);
2425
@@ -46,6 +47,7 @@ beforeAll(async () => {
4647 take(pr, HEAD, { kind: "phone" });
4748 take(pr, HEAD, { kind: "phone", theme: "dark" });
4849 take(pr, HEAD, { kind: "desktop" }); // main has no desktop look
50 pullNumber = o.value.number;
4951 servers = await serve(app);
5052 page = await (await fetch(`${servers.url}/alice/garden/pulls/${o.value.number}`)).text();
5153 }, 30_000);
@@ -88,3 +90,15 @@ test("an unpaired look stands alone, and every image keeps its size", () => {
8890 for (const img of page.match(/<img[^>]*looks\/[^>]*>/g) ?? [])
8991 expect(img).toMatch(/width="\d+"[\s\S]*height="\d+"/);
9092 });
93
94 test("with no picture on main, the head stands alone under one line, no empty frame", async () => {
95 expect(page).not.toContain("data-no-main");
96 app.db.run("DELETE FROM look WHERE env = 'production'");
97 const text = await (await fetch(`${servers.url}/alice/garden/pulls/${pullNumber}`)).text();
98 expect(text).toContain("main has no picture of this page yet.");
99 expect(text).not.toContain("data-compare");
100 expect(text).not.toContain(">this pull<");
101 expect(text).toContain(`/${HEAD}/phone.png`);
102 expect(text).toContain(`/${HEAD}/desktop.png`);
103 expect(text).not.toContain(MAIN);
104 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs