import { readdirSync, readFileSync } from "node:fs"; import { join } from "node:path"; import { describe, expect, it } from "vitest"; // Tailwind 3 stacks variants in the opposite order to v4: `*:data-[slot=x]:foo` compiles to // `.cls[data-slot=x] > *`, so a shadcn v4 class meant for the `data-slot=x` child never matches. // That is how the select value stopped clipping. Use `[&>[data-slot=x]]:foo` instead. describe("ui primitives", () => { it("use no `*:` child variant, which Tailwind 3 compiles inside out", () => { const dir = join(__dirname); const offenders = readdirSync(dir) .filter((f) => f.endsWith(".tsx") && !f.includes(".test.")) .filter((f) => /(^|[\s"'`])\*:/.test(readFileSync(join(dir, f), "utf8"))); expect(offenders).toEqual([]); }); });