FN-5934: replace undefined dashboard spacing token
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
This commit is contained in:
45
packages/dashboard/app/__tests__/space-token-defined.test.ts
Normal file
45
packages/dashboard/app/__tests__/space-token-defined.test.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
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:");
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
.confirm-dialog__checkbox {
|
||||
display: grid;
|
||||
gap: var(--space-2xs);
|
||||
gap: var(--space-xs);
|
||||
margin: 0 var(--space-xl) var(--space-lg);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,8 +79,8 @@
|
||||
.merge-advance-notice__push-advanced label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2xs);
|
||||
margin-top: var(--space-2xs);
|
||||
gap: var(--space-xs);
|
||||
margin-top: var(--space-xs);
|
||||
}
|
||||
|
||||
.merge-advance-notice__push-error {
|
||||
@@ -88,8 +88,8 @@
|
||||
}
|
||||
|
||||
.merge-advance-notice__push-error pre {
|
||||
margin: var(--space-2xs) 0;
|
||||
padding: var(--space-2xs);
|
||||
margin: var(--space-xs) 0;
|
||||
padding: var(--space-xs);
|
||||
border-radius: var(--radius-sm);
|
||||
background: color-mix(in srgb, var(--color-error) 12%, transparent);
|
||||
color: var(--color-error);
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--color-error);
|
||||
justify-content: center;
|
||||
padding: var(--space-2xs) var(--space-sm);
|
||||
padding: var(--space-xs) var(--space-sm);
|
||||
}
|
||||
|
||||
.pr-checks__details-link--failing:hover {
|
||||
|
||||
Reference in New Issue
Block a user