Replace dashboard CSS uses of the undefined --space-2xs token with supported spacing values. - swap var(--space-2xs) for var(--space-xs) in confirm dialog, merge advance notice, and PR checks styles - add a dashboard test that scans component stylesheets for undefined --space-2xs references - assert shared token sources continue to omit an intentional --space-2xs definition Files changed: .../app/__tests__/space-token-defined.test.ts | 45 ++++++++++++++++++++++ .../dashboard/app/components/ConfirmDialog.css | 2 +- .../app/components/MergeAdvanceNotice.css | 8 ++-- packages/dashboard/app/components/PrChecksList.css | 2 +- 4 files changed, 51 insertions(+), 6 deletions(-) Fusion-Task-Id: FN-5934 Fusion-Task-Lineage: aa77df19-3f76-4ede-aa42-0396230edde5
46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
import { readdirSync, readFileSync } from "node:fs";
|
|
import { join, resolve } from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const appDir = resolve(__dirname, "..");
|
|
const componentsDir = resolve(appDir, "components");
|
|
const stylesPath = resolve(appDir, "styles.css");
|
|
const themeDataPath = resolve(appDir, "public/theme-data.css");
|
|
|
|
function listComponentCssFiles(): string[] {
|
|
return readdirSync(componentsDir)
|
|
.filter((name) => name.endsWith(".css"))
|
|
.sort();
|
|
}
|
|
|
|
describe("dashboard spacing token hygiene", () => {
|
|
it("does not reference undefined --space-2xs in any component stylesheet", () => {
|
|
const violations: string[] = [];
|
|
|
|
for (const fileName of listComponentCssFiles()) {
|
|
const filePath = join(componentsDir, fileName);
|
|
const source = readFileSync(filePath, "utf8");
|
|
const lines = source.split(/\r?\n/);
|
|
|
|
for (let index = 0; index < lines.length; index += 1) {
|
|
if (lines[index].includes("var(--space-2xs)")) {
|
|
violations.push(`${fileName}:${index + 1}:${lines[index].trim()}`);
|
|
}
|
|
}
|
|
}
|
|
|
|
expect(violations).toEqual([]);
|
|
});
|
|
|
|
it("documents that --space-2xs remains intentionally undefined in shared token sources", () => {
|
|
const tokenSources = [
|
|
{ name: "styles.css", source: readFileSync(stylesPath, "utf8") },
|
|
{ name: "theme-data.css", source: readFileSync(themeDataPath, "utf8") },
|
|
];
|
|
|
|
for (const { name, source } of tokenSources) {
|
|
expect(source).not.toContain("--space-2xs:");
|
|
}
|
|
});
|
|
});
|