import { describe, expect, it } from "vitest"; import { getContainerShapeClass, getShapeClass, getShapeClipPath, } from "./shapeClasses"; describe("getShapeClipPath", () => { it("returns polygons for clip-path shapes and null otherwise", () => { expect(getShapeClipPath("diamond")).toContain("polygon("); expect(getShapeClipPath("hexagon")).toContain("polygon("); expect(getShapeClipPath("circle")).toBeNull(); expect(getShapeClipPath("square")).toBeNull(); }); it("normalizes case and whitespace", () => { expect(getShapeClipPath(" Diamond ")).toContain("polygon("); }); }); describe("getShapeClass", () => { it("maps radius-based shapes to their utility classes", () => { expect(getShapeClass("circle")).toBe("bwvs:rounded-full"); expect(getShapeClass("pill")).toBe("bwvs:rounded-full"); expect(getShapeClass("squircle")).toBe("bwvs:rounded-[22%]"); expect(getShapeClass("rounded")).toBe("bwvs:rounded-md"); expect(getShapeClass("soft")).toBe("bwvs:rounded-xs"); expect(getShapeClass("square")).toBe("bwvs:rounded-none"); expect(getShapeClass("unknown-shape")).toBe("bwvs:rounded-none"); }); it("emits a clip-path utility (spaces underscored) for diamond/hexagon", () => { const cls = getShapeClass("diamond"); expect(cls).toContain("bwvs:rounded-none"); expect(cls).toContain("bwvs:[clip-path:"); expect(cls).toContain("50%_0%"); expect(cls).not.toContain("polygon(50% 0%"); }); }); describe("getContainerShapeClass", () => { it("falls back to a square container for clip-path shapes", () => { expect(getContainerShapeClass("diamond")).toBe("bwvs:rounded-none"); expect(getContainerShapeClass("hexagon")).toBe("bwvs:rounded-none"); expect(getContainerShapeClass("circle")).toBe("bwvs:rounded-full"); expect(getContainerShapeClass("squircle")).toBe("bwvs:rounded-[22%]"); }); });