import { readFileSync } from "node:fs"; import { join } from "node:path"; import { describe, expect, it } from "vitest"; // react-remove-scroll (Radix Select/Dialog/Sheet/DropdownMenu) adds `margin-right: ` // to body while scroll is locked; html already reserves that gutter (scrollbar-gutter: stable), so // without this override the page narrows by the scrollbar width every time an overlay opens. describe("globals.css", () => { it("keeps the reserved gutter and cancels scroll-lock's body margin", () => { const css = readFileSync(join(__dirname, "globals.css"), "utf8"); expect(css).toMatch(/html\s*\{[^}]*scrollbar-gutter:\s*stable/); expect(css).toMatch(/html body\[data-scroll-locked\]\s*\{[^}]*margin-right:\s*0\s*!important/); }); it("marks today on the admin calendar with a bold ring that selected days skip", () => { const css = readFileSync(join(__dirname, "globals.css"), "utf8"); const rule = css.match( /\.rdp-root\.admin-calendar\s+\.rdp-today:not\(\.rdp-selected\):not\(\.rdp-outside\)\s+\.rdp-day_button\s*\{([^}]*)\}/, ); expect(rule).not.toBeNull(); expect(rule![1]).toMatch(/font-weight:\s*700/); expect(rule![1]).toMatch(/box-shadow:\s*inset\s+0\s+0\s+0\s+2px\s+var\(--primary\)/); }); it("keeps today visible when selected, with a primary-foreground ring over the fill", () => { const css = readFileSync(join(__dirname, "globals.css"), "utf8"); const rule = css.match( /\.rdp-root\.admin-calendar\s+\.rdp-today\.rdp-selected:not\(\.rdp-outside\)\s+\.rdp-day_button\s*\{([^}]*)\}/, ); expect(rule).not.toBeNull(); expect(rule![1]).toMatch(/font-weight:\s*700/); expect(rule![1]).toMatch(/box-shadow:\s*inset\s+0\s+0\s+0\s+2px\s+var\(--primary-foreground\)/); }); });