mirror of
https://github.com/YuzuZensai/Termix.git
synced 2026-11-12 14:16:36 +00:00
22 lines
615 B
TypeScript
22 lines
615 B
TypeScript
import { describe, it, expect } from "vitest";
|
|||
|
|
import { cn } from "./utils.js";
|
||
|
|
|
||
|
|
describe("cn", () => {
|
||
|
|
it("joins class names", () => {
|
||
|
|
expect(cn("a", "b")).toBe("a b");
|
||
|
|
});
|
||
|
|
|
||
|
|
it("drops falsy values", () => {
|
||
|
|
expect(cn("a", false, null, undefined, "b")).toBe("a b");
|
||
|
|
});
|
||
|
|
|
||
|
|
it("merges conflicting tailwind classes, keeping the last", () => {
|
||
|
|
expect(cn("p-2", "p-4")).toBe("p-4");
|
||
|
|
expect(cn("text-red-500", "text-blue-500")).toBe("text-blue-500");
|
||
|
|
});
|
||
|
|
|
||
|
|
it("supports conditional object syntax", () => {
|
||
|
|
expect(cn("base", { active: true, hidden: false })).toBe("base active");
|
||
|
|
});
|
||
|
|
});
|