import { readFileSync } from "node:fs"; import { fileURLToPath } from "node:url"; import { describe, expect, it } from "vitest"; const stylesheet = readFileSync(fileURLToPath(new URL("../index.css", import.meta.url)), "utf8"); function cssBlock(selector: string): string { const start = stylesheet.indexOf(`${selector} {`); expect(start, `Missing CSS selector: ${selector}`).toBeGreaterThanOrEqual(0); const bodyStart = stylesheet.indexOf("{", start); const bodyEnd = stylesheet.indexOf("\n}", bodyStart); expect(bodyStart, `Missing CSS block start: ${selector}`).toBeGreaterThanOrEqual(0); expect(bodyEnd, `Missing CSS block end: ${selector}`).toBeGreaterThan(bodyStart); return stylesheet.slice(bodyStart + 1, bodyEnd); } describe("markdown document card styles", () => { it("removes the inherited markdown link underline so the card label shows one underline", () => { expect(cssBlock(".paperclip-markdown a")).toContain("text-decoration: underline"); expect(cssBlock(".paperclip-markdown a[data-sidebar-document-link]")).toContain("text-decoration: none"); }); });