feat(FN-3471): apply tokenized sizing and focus styles to component CSS

Merged CSS changes that apply tokenized sizing and focus styles to InsightsView and DesktopModeChooser components, with the majority of changes in InsightsView.css.

Fusion-Task-Id: FN-3471
This commit is contained in:
Fusion
2026-05-05 00:15:52 -07:00
committed by gsxdsm
parent cd1d44abab
commit bb4a1b7df4
10 changed files with 128 additions and 50 deletions

View File

@@ -8,7 +8,7 @@ vi.mock("node:child_process", () => ({
spawn: spawnMock,
}));
import { probeDroidBinary } from "../probe.js";
import { probeDroidBinary, resolveDroidBinaryPath } from "../probe.js";
describe("probeDroidBinary", () => {
beforeEach(() => {
@@ -26,7 +26,7 @@ describe("probeDroidBinary", () => {
const result = await probeDroidBinary({ timeoutMs: 10 });
expect(result.available).toBe(false);
expect(result.reason).toContain("not found");
expect(result.reason).toContain("Binary not found or not executable");
});
it("returns available and version on success", async () => {
@@ -46,6 +46,19 @@ describe("probeDroidBinary", () => {
expect(result.version).toBe("droid 1.2.3");
});
it("uses binary path from plugin settings", async () => {
spawnMock.mockImplementationOnce(() => {
const proc = new EventEmitter() as any;
proc.stdout = new PassThrough();
proc.stderr = new PassThrough();
queueMicrotask(() => proc.emit("close", 1));
return proc;
});
await probeDroidBinary({ settings: { droidBinaryPath: " /custom/from-settings " } });
expect(spawnMock).toHaveBeenCalledWith("/custom/from-settings", ["--version"], expect.anything());
});
it("uses custom binary path", async () => {
spawnMock.mockImplementationOnce(() => {
const proc = new EventEmitter() as any;
@@ -58,4 +71,10 @@ describe("probeDroidBinary", () => {
await probeDroidBinary({ binaryPath: "/custom/droid" });
expect(spawnMock).toHaveBeenCalledWith("/custom/droid", ["--version"], expect.anything());
});
it("falls back to droid when plugin setting is missing or blank", () => {
expect(resolveDroidBinaryPath()).toBe("droid");
expect(resolveDroidBinaryPath({})).toBe("droid");
expect(resolveDroidBinaryPath({ droidBinaryPath: " " })).toBe("droid");
});
});

View File

@@ -9,6 +9,13 @@ export interface DroidBinaryStatus {
probeDurationMs: number;
}
export function resolveDroidBinaryPath(settings?: Record<string, unknown>): string {
if (typeof settings?.droidBinaryPath === "string" && settings.droidBinaryPath.trim().length > 0) {
return settings.droidBinaryPath.trim();
}
return "droid";
}
async function run(binary: string, args: string[], timeoutMs = 2000): Promise<{ code: number | null; stdout: string; stderr: string }> {
return new Promise((resolve) => {
const child = spawn(binary, args, { stdio: ["ignore", "pipe", "pipe"] });
@@ -33,9 +40,9 @@ async function run(binary: string, args: string[], timeoutMs = 2000): Promise<{
});
}
export async function probeDroidBinary(options?: { binaryPath?: string; timeoutMs?: number }): Promise<DroidBinaryStatus> {
export async function probeDroidBinary(options?: { binaryPath?: string; settings?: Record<string, unknown>; timeoutMs?: number }): Promise<DroidBinaryStatus> {
const startedAt = Date.now();
const binaryPath = options?.binaryPath?.trim() || "droid";
const binaryPath = options?.binaryPath?.trim() || resolveDroidBinaryPath(options?.settings);
const timeoutMs = options?.timeoutMs ?? 2000;
const versionRun = await run(binaryPath, ["--version"], timeoutMs);
@@ -43,7 +50,10 @@ export async function probeDroidBinary(options?: { binaryPath?: string; timeoutM
return {
available: false,
binaryPath,
reason: versionRun.code === 124 ? `Probe timed out after ${timeoutMs}ms` : "`droid` not found on PATH",
reason:
versionRun.code === 124
? `Probe timed out after ${timeoutMs}ms`
: `Binary not found or not executable: ${binaryPath}`,
probeDurationMs: Date.now() - startedAt,
};
}