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/); }); });