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.
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -15,8 +15,10 @@ async function refused(source: string): Promise<number> {
|
||||
|
||||
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 () => {
|
||||
|
||||
Reference in New Issue
Block a user