Files
paseo/packages/app/src/git/file-header-presentation.test.ts
T
Mohamed Boudra 3998ea11d9 Keep large diffs responsive across web and mobile (#4174)
* perf(app): keep large diffs responsive

Render file headers on the canvas and bound expensive text shaping to the active viewport while preserving sticky, hover, and horizontal-scroll behavior. Let native scroll cancellation arbitrate header presses so finger scrolling cannot expand files.

* test(app): assert canvas diff header accessibility

* test(app): assert canvas diff header semantics
2026-09-01 23:52:11 +02:00

23 lines
873 B
TypeScript

import { describe, expect, it } from "vitest";
import { allocateDiffHeaderTextWidths } from "./file-header-presentation";
describe("diff file header text allocation", () => {
it("gives the filename its full width before truncating the directory", () => {
expect(
allocateDiffHeaderTextWidths({ available: 120, nameWidth: 80, directoryWidth: 100 }),
).toEqual({ name: 80, directory: 36 });
});
it("uses all available width for a filename that cannot fit", () => {
expect(
allocateDiffHeaderTextWidths({ available: 60, nameWidth: 80, directoryWidth: 100 }),
).toEqual({ name: 60, directory: 0 });
});
it("does not truncate a fitting filename merely to reserve the gap", () => {
expect(
allocateDiffHeaderTextWidths({ available: 82, nameWidth: 80, directoryWidth: 100 }),
).toEqual({ name: 80, directory: 0 });
});
});