41 lines · 2.0 KB · TypeScript
RawDownload
import { describe, expect, it } from "vitest";import { footerHints, HELP_GROUPS, type Hint } from "./keymap"; // Footer.tsx renders hints as "keys label" joined by a 3-space separator, and// the app pads one column each side, so a row must fit 80 - 2 at 80 cols.const rowWidth = (hints: Hint[]): number =>  hints.reduce((n, h) => n + h.keys.length + 1 + h.label.length, 0) + (hints.length - 1) * 3; describe("downloads/seeding key vocabulary", () => {  it("folds clear-all into shift+c on the c row and drops x", () => {    const downloads = HELP_GROUPS.find((g) => g.title === "Downloads")!;    expect(downloads.hints.some((h) => h.keys === "x")).toBe(false);    expect(downloads.hints.some((h) => h.keys === "shift+c")).toBe(false);    expect(downloads.hints.find((h) => h.keys === "c")?.label).toContain("(shift+c");  });   it("labels one-entry removal as list bookkeeping in the footers", () => {    const recent = footerHints("content", "downloads", "recent", null);    expect(recent.some((h) => h.keys === "x")).toBe(false);    expect(recent.find((h) => h.keys === "c")?.label).toBe("Remove from list");     const seeding = footerHints("content", "seeding", null, "seeding");    expect(seeding.find((h) => h.keys === "c")?.label).toBe("Remove from list");  });   // The results row carries a known pre-existing overflow (f Filter), so the  // budget is pinned only for the rows this vocabulary owns.  it("keeps the downloads and seeding footer rows inside the 80-col budget", () => {    const rows = [      footerHints("sidebar", "downloads", null, null),      footerHints("content", "downloads", "downloading", null),      footerHints("content", "downloads", "paused", null),      footerHints("content", "downloads", "failed", null),      footerHints("content", "downloads", "recent", null),      footerHints("content", "seeding", null, "seeding"),      footerHints("content", "seeding", null, "missing"),      footerHints("content", "seeding", null, null),    ];    for (const row of rows) expect(rowWidth(row)).toBeLessThanOrEqual(78);  });});

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t