Fix issue

This commit is contained in:
Alex
2025-02-03 00:05:24 -05:00
parent 2c4b75aa6c
commit 1f5e7fa049
14 changed files with 135 additions and 22 deletions

View File

@ -0,0 +1,27 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`emit > supports emitting as CSS module 1`] = `
"// babel-tailwind:/Users/aet/Documents/Git/babel-tailwind/src/.temp-attr/index.module.css
var index_default = {
"tw-gqn2k6": "index_tw-gqn2k6",
"tw-1qtvvjy": "index_tw-1qtvvjy"
};
import { cx as _cx } from "@emotion/css";
import { jsx } from "react/jsx-runtime";
function Hello() {
return /* @__PURE__ */ jsx("div", { className: _cx([index_default["tw-gqn2k6"], index_default["tw-1qtvvjy"]]), children: "Hello, world!" });
}
export {
Hello
};"
`;
exports[`emit > supports emitting as CSS module 2`] = `
".index_tw-gqn2k6 {
text-align: center;
}
.index_tw-1qtvvjy:hover {
font-weight: 600;
}"
`;

View File

@ -1,4 +1,5 @@
import { describe, it } from "vitest";
import { getBuild, matchSnapshot } from "./utils";
describe("attr", () => {
@ -61,7 +62,7 @@ describe("attr", () => {
matchSnapshot(files);
});
it.only("fails", async () => {
it("fails", async () => {
const { files } = await compileESBuild({
clsx: "emotion",
expectFiles: 2,

View File

@ -1,5 +1,7 @@
import { describe, expect, it } from "vitest";
import { createPostCSS } from "../index";
import { getBuild, minCSS, name } from "./utils";
describe("babel-tailwind", () => {

View File

@ -0,0 +1,26 @@
import { describe, it } from "vitest";
import { getBuild, matchSnapshot } from "./utils";
describe("emit", () => {
const compileESBuild = getBuild("attr");
it("supports emitting as CSS module", async () => {
const { files } = await compileESBuild({
clsx: "emotion",
expectFiles: 2,
cssModules: true,
javascript: /* tsx */ `
export function Hello() {
return (
<div css={["text-center", { hover: "font-semibold" }]}>
Hello, world!
</div>
);
}
`,
});
matchSnapshot(files);
});
});

View File

@ -1,6 +1,8 @@
/* eslint-disable unicorn/string-content */
import { describe, expect, it } from "vitest";
import { getClassName } from "../index";
import { getBuild } from "./utils";
describe("merges with existing className attribute", () => {

View File

@ -1,4 +1,5 @@
import { describe, expect, it } from "vitest";
import { getBuild, matchSnapshot } from "./utils";
describe("options", () => {

View File

@ -1,4 +1,5 @@
import { describe, it } from "vitest";
import { getBuild, matchSnapshot } from "./utils";
describe("babel-tailwind", () => {

View File

@ -1,4 +1,5 @@
import { describe, it } from "vitest";
import { getBuild, matchSnapshot } from "./utils";
describe("babel-tailwind", () => {

View File

@ -1,8 +1,10 @@
import { promises as fs } from "node:fs";
import { join, resolve } from "node:path";
import { afterEach, beforeEach, expect } from "vitest";
import * as esbuild from "esbuild";
import dedent from "dedent";
import * as esbuild from "esbuild";
import { afterEach, beforeEach, expect } from "vitest";
import { type TailwindPluginOptions, babelPlugin, getTailwindPlugins } from "../index";
export { name } from "../../package.json" with { type: "json" };