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

Merged opened this

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

Merged

scout/forge:scout/10046-an-empty-diff-says-no-changes-in-one-pla → main 3 commits fork 3 threads · 3 unresolved

  • Merged. scout/10046-an-empty-diff-says-no-changes-in-one-pla was merged into main as 1c43699.

Review

Sign in to review this change.
2 files changed +15 −2
src/web/diff-view.ts +2 −2
@@ -21,7 +21,7 @@ import {
2121 import { composeLine } from "./code.ts";
2222 import type { Token } from "./highlight.ts";
2323 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";
2525 import { renderMarkdown } from "./markdown.ts";
2626 import { wordDiff, type Segment } from "./worddiff.ts";
2727
@@ -571,7 +571,7 @@ export function renderDiff(
571571 const opts: DiffViewOptions =
572572 options instanceof Map ? { syntax: options } : (options ?? {});
573573 if (diff.files.length === 0) {
574 return html`<div class="empty">No changes.</div>`;
574 return empty({ title: "No changes." });
575575 }
576576 const shown = diff.files.slice(0, MAX_DIFF_FILES);
577577 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)", () => {
334334 expect(out).not.toContain("View file");
335335 });
336336 });
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/);

These assertions already held on the base (it was a bare div.empty), so the test does not fail without the change. Assert class="empty-title" with No changes. inside it.

348 });
349 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs