Update
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getClassName } from "../index";
|
||||
import { getBuild } from "./utils";
|
||||
import { describe, it } from "vitest";
|
||||
import { getBuild, matchSnapshot } from "./utils";
|
||||
|
||||
describe("babel-tailwind", () => {
|
||||
const compileESBuild = getBuild("tw");
|
||||
@ -25,31 +24,7 @@ describe("babel-tailwind", () => {
|
||||
`,
|
||||
});
|
||||
|
||||
const clsName = getClassName(
|
||||
"text-sm flex group-hover:text-center [&>div]:font-semibold data-[name='hello']:text-right data-[nested=true]:border"
|
||||
);
|
||||
expect(files.js.text).toContain(`= "${clsName}"`);
|
||||
expect(files.css.text).toMatch(
|
||||
[
|
||||
`.${clsName} {`,
|
||||
" display: flex;",
|
||||
" font-size: 0.875rem;",
|
||||
" line-height: 1.25rem;",
|
||||
"}",
|
||||
`.group:hover .${clsName} {`,
|
||||
" text-align: center;",
|
||||
"}",
|
||||
`.${clsName}[data-nested=true] {`,
|
||||
" border-width: 1px;",
|
||||
"}",
|
||||
`.${clsName}[data-name=hello] {`,
|
||||
" text-align: right;",
|
||||
"}",
|
||||
`.${clsName} > div {`,
|
||||
" font-weight: 600;",
|
||||
"}",
|
||||
].join("\n")
|
||||
);
|
||||
matchSnapshot(files);
|
||||
});
|
||||
|
||||
it("passes through `group` className", async () => {
|
||||
@ -63,10 +38,6 @@ describe("babel-tailwind", () => {
|
||||
`,
|
||||
});
|
||||
|
||||
const clsName = getClassName("group hover:text-center");
|
||||
expect(files.js.text).toContain(`"${clsName} group"`);
|
||||
expect(files.css.text).toMatch(
|
||||
[`.${clsName}:hover {`, " text-align: center;", "}"].join("\n")
|
||||
);
|
||||
matchSnapshot(files);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user