babel-tailwind/src/index.test.ts
2025-01-24 01:29:15 -05:00

30 lines
753 B
TypeScript

import { describe, expect, it } from "vitest";
import { getBuild } from "./__tests__/utils";
import { getClassName } from "./index";
describe("babel-tailwind", () => {
const compileESBuild = getBuild("main");
it("supports ESBuild", async () => {
const { files } = await compileESBuild({
clsx: "emotion",
expectFiles: 2,
javascript: /* tsx */ `
export function Hello() {
return (
<div css="text-center">
Hello, world!
</div>
);
}
`,
});
const clsName = getClassName("text-center");
expect(files.js.text).toContain(`className: "${clsName}"`);
expect(files.css.text).toMatch(`.${clsName} {\n text-align: center;\n}`);
});
});