From df7c3db085e8ade7381d167091d3be6d617b6411 Mon Sep 17 00:00:00 2001 From: npeter83 Date: Sat, 19 Sep 2026 07:53:01 +0200 Subject: [PATCH] test(ui): the px-box probe does not trip its own rule; tsc lib-safe last() The pxBox contract test held the literal w-[150px] it probes, which the new lint rule refuses, and stickyTop's test used Array.at, outside the tsconfig lib. Both landed because a local lane check piped its exit code into tail. --- frontend/src/components/ui/stickyTop.dom.test.tsx | 8 +++++--- frontend/src/lib/pxBox.contract.test.ts | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/ui/stickyTop.dom.test.tsx b/frontend/src/components/ui/stickyTop.dom.test.tsx index 427984a5..373becbc 100644 --- a/frontend/src/components/ui/stickyTop.dom.test.tsx +++ b/frontend/src/components/ui/stickyTop.dom.test.tsx @@ -22,6 +22,8 @@ vi.mock("react-i18next", async (importOriginal) => { import PageScroller from "./PageScroller"; import { ColumnHead } from "./tableHeader"; +const last = () => fadeTopArgs[fadeTopArgs.length - 1]; + afterEach(() => { cleanup(); fadeTopArgs.length = 0; @@ -50,13 +52,13 @@ function page(withTable: boolean) { describe("the page scroller's top fade and a sticky table header", () => { it("is off while the header is mounted, and back on the moment it is gone", () => { const view = render(page(true)); - expect(fadeTopArgs.at(-1)).toBe(false); + expect(last()).toBe(false); view.rerender(page(false)); // e.g. the Channels card layout, or a narrow DataTable - expect(fadeTopArgs.at(-1)).toBe(true); + expect(last()).toBe(true); }); it("is on for a page with no sticky header at all", () => { render(page(false)); - expect(fadeTopArgs.at(-1)).toBe(true); + expect(last()).toBe(true); }); }); diff --git a/frontend/src/lib/pxBox.contract.test.ts b/frontend/src/lib/pxBox.contract.test.ts index d8421751..1d1e34f2 100644 --- a/frontend/src/lib/pxBox.contract.test.ts +++ b/frontend/src/lib/pxBox.contract.test.ts @@ -15,8 +15,10 @@ async function refused(source: string): Promise { describe("a px-frozen box utility", () => { it("is refused in a string and in a template literal", async () => { - expect(await refused('export const a = "group w-[150px] shrink-0";\n')).toBe(1); - expect(await refused("export const b = `x ${1} max-w-[240px]`;\n")).toBe(1); + // Assembled, so this file does not trip the very rule it probes. + const px = (u: string, n: number) => `${u}-[${n}px]`; + expect(await refused(`export const a = "group ${px("w", 150)} shrink-0";\n`)).toBe(1); + expect(await refused("export const b = `x ${1} " + px("max-w", 240) + "`;\n")).toBe(1); }); it("leaves the spacing scale, a rem arbitrary and a grid track alone", async () => {