test(FN-4270): complete Step 3 — add file path link style regression

Fusion-Task-Id: FN-4270
Fusion-Task-Lineage: 6e346590-2dd5-43cd-912f-9f9cbfb3421a
This commit is contained in:
Fusion
2026-05-12 23:18:53 -07:00
committed by gsxdsm
parent 900d0f9b43
commit 78969e3205

View File

@@ -59,4 +59,35 @@ describe("filePathLinkify", () => {
expect(styles.whiteSpace).toBe("normal");
expect(styles.display).not.toBe("inline-flex");
});
it("inherits surrounding text color and left-aligns wrapped path text", () => {
const openFile = vi.fn();
render(
<FileBrowserProvider openFile={openFile}>
<div style={{ color: "rgb(10, 20, 30)" }}>
<FilePathLink path="src/foo.ts">src/foo.ts</FilePathLink>
</div>
</FileBrowserProvider>,
);
const button = screen.getByRole("button", { name: "src/foo.ts" });
const styles = getComputedStyle(button);
expect(styles.color).toBe("rgb(10, 20, 30)");
expect(styles.color).not.toBe("rgb(47, 129, 247)");
expect(styles.display).toBe("inline");
expect(styles.display).not.toBe("inline-flex");
const filePathLinkRule = Array.from(document.styleSheets)
.flatMap((sheet) => Array.from(sheet.cssRules))
.find(
(rule): rule is CSSStyleRule =>
rule instanceof CSSStyleRule && rule.selectorText === ".file-path-link",
);
expect(filePathLinkRule).toBeDefined();
expect(filePathLinkRule?.style.textAlign).toBe("left");
expect(filePathLinkRule?.style.color).toBe("inherit");
});
});