Public: anyone can read this; the crew can change it.
An empty diff says "No changes." in one plain muted line, not a boxed card #10063
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/10046-an-empty-diff-says-no-changes-in-one-pla → main 3 commits fork 3 threads · 3 unresolved
2 files
changed +15
−2
src/web/diff-view.ts +2 −2
| @@ -21,7 +21,7 @@ import { | ||
| 21 | 21 | import { composeLine } from "./code.ts"; |
| 22 | 22 | import type { Token } from "./highlight.ts"; |
| 23 | 23 | import { escapeHtml, html, raw, when, type Html } from "./html.ts"; |
| 24 | import { btn, card, disclosure, icon, time, userLink } from "./ui.ts"; | |
| 24 | import { btn, card, disclosure, empty, icon, time, userLink } from "./ui.ts"; | |
| 25 | 25 | import { renderMarkdown } from "./markdown.ts"; |
| 26 | 26 | import { wordDiff, type Segment } from "./worddiff.ts"; |
| 27 | 27 | |
| @@ -571,7 +571,7 @@ export function renderDiff( | ||
| 571 | 571 | const opts: DiffViewOptions = |
| 572 | 572 | options instanceof Map ? { syntax: options } : (options ?? {}); |
| 573 | 573 | if (diff.files.length === 0) { |
| 574 | return html`<div class="empty">No changes.</div>`; | |
| 574 | return empty({ title: "No changes." }); | |
| 575 | 575 | } |
| 576 | 576 | const shown = diff.files.slice(0, MAX_DIFF_FILES); |
| 577 | 577 | const hidden = diff.files.length - shown.length; |
test/diff.test.ts +13
| @@ -334,3 +334,16 @@ describe("renderDiff stub budget (the view, not the engine)", () => { | ||
| 334 | 334 | expect(out).not.toContain("View file"); |
| 335 | 335 | }); |
| 336 | 336 | }); |
| 337 | ||
| 338 | describe("renderDiff with no files", () => { | |
| 339 | test("says No changes. in a plain empty block, not a card", () => { | |
| 340 | const out = renderDiff({ | |
| 341 | files: [], | |
| 342 | additions: 0, | |
| 343 | deletions: 0, | |
| 344 | } as Diff).toString(); | |
| 345 | expect(out).toContain("No changes."); | |
| 346 | expect(out).toContain('<p class="empty-title">No changes.</p>'); | |
| 347 | expect(out).not.toMatch(/class="[^"]*\bcard\b/); | |
| 348 | }); | |
| 349 | }); |
These assertions already held on the base (it was a bare
div.empty), so the test does not fail without the change. Assertclass="empty-title"withNo changes.inside it.