fix(documents): keep four tiles across a 1440 px window with the day strip docked

This commit is contained in:
Marc-André Bombeck committed 2026-10-09 20:21:10 +02:00
1 parent 3becc235ae
commit e6a2429df9
4 files changed
+16 -4

No files matched your search

+1 -1
View File
@@ -89,7 +89,7 @@ test.describe("document vault — procedure filter", () => {
const knee = menu.getByRole("menuitemcheckbox", {
name: /Knee arthroscopy/,
});
await expect(knee).toContainText("Knee · Left");
await expect(knee).toContainText("Knee (Left)");
await expect(
menu.getByRole("menuitemcheckbox", { name: /Appendectomy/ }),
).toBeVisible();
@@ -62,6 +62,9 @@ describe("columnsForWidth", () => {
expect(columnsForWidth(1024 - 48)).toBe(3);
// 1440 viewport: the shell caps the container at 1280 minus its gutters.
expect(columnsForWidth(1280 - 48)).toBe(4);
// 1440 with the sidebar and the day strip docked: about 1 040 px left,
// still four tiles of about 240 px.
expect(columnsForWidth(1040)).toBe(4);
});
it("never asks for a fifth column", () => {
@@ -16,7 +16,7 @@ import { DocumentCard } from "./document-card";
/** Measured grid width → tiles per row. */
export function columnsForWidth(width: number): number {
if (width >= 1100) return 4;
if (width >= 1000) return 4;
if (width >= 760) return 3;
if (width >= 330) return 2;
return 1;
@@ -68,8 +68,17 @@ function renderBar(): string {
);
}
/** The text a reader sees, tags dropped. */
const textOf = (html: string) => html.replace(/<[^>]*>/g, "");
/** The text a reader sees, tags dropped (a character walk, not a regex). */
function textOf(html: string): string {
let out = "";
let inTag = false;
for (const ch of html) {
if (ch === "<") inTag = true;
else if (ch === ">") inTag = false;
else if (!inTag) out += ch;
}
return out;
}
describe("lab day in the selection bar", () => {
it("sets the count apart from the analyte names", () => {