Add array support
This commit is contained in:
@ -1,11 +1,37 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`attr > supports array expressions in "css" attribute 1`] = `
|
||||
"import { cx as _cx } from "@emotion/css";
|
||||
import { jsx, jsxs } from "react/jsx-runtime";
|
||||
function Hello({
|
||||
bold
|
||||
}) {
|
||||
return /* @__PURE__ */ jsxs("div", { className: "tw-gqn2k6 tw-169ynv4", children: [
|
||||
/* @__PURE__ */ jsx("div", { className: _cx(["tw-gqn2k6", bold && "tw-169ynv4"]), children: "Hello," }),
|
||||
"world!"
|
||||
] });
|
||||
}
|
||||
export {
|
||||
Hello
|
||||
};"
|
||||
`;
|
||||
|
||||
exports[`attr > supports array expressions in "css" attribute 2`] = `
|
||||
".tw-gqn2k6 {
|
||||
text-align: center;
|
||||
}
|
||||
.tw-169ynv4 {
|
||||
font-weight: 600;
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`attr > supports conditional expression in "css" attribute 1`] = `
|
||||
"import { jsx } from "react/jsx-runtime";
|
||||
"import { cx as _cx } from "@emotion/css";
|
||||
import { jsx } from "react/jsx-runtime";
|
||||
function Hello({
|
||||
isCenter
|
||||
}) {
|
||||
return /* @__PURE__ */ jsx("div", { className: isCenter ? "tw-gqn2k6" : void 0, children: "Hello, world!" });
|
||||
return /* @__PURE__ */ jsx("div", { className: _cx(isCenter ? "tw-gqn2k6" : void 0), children: "Hello, world!" });
|
||||
}
|
||||
export {
|
||||
Hello
|
||||
|
@ -23,12 +23,10 @@ var tw_1qtvvjy = {
|
||||
}
|
||||
};
|
||||
|
||||
// src/.temp-styleObject/index.tsx
|
||||
var style = [tw_1qtvvjy, tw_12x0ow0, tw_m4tg46, tw_rqrjo3];
|
||||
export {
|
||||
style
|
||||
};
|
||||
"
|
||||
};"
|
||||
`;
|
||||
|
||||
exports[`babel-tailwind > supports conversion into CSSProperties 1`] = `
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, it } from "vitest";
|
||||
import { getBuild, matchSnapshot } from "./utils";
|
||||
|
||||
describe("attr", () => {
|
||||
@ -39,4 +39,25 @@ describe("attr", () => {
|
||||
|
||||
matchSnapshot(files);
|
||||
});
|
||||
|
||||
it('supports array expressions in "css" attribute', async () => {
|
||||
const { files } = await compileESBuild({
|
||||
clsx: "emotion",
|
||||
expectFiles: 2,
|
||||
javascript: /* tsx */ `
|
||||
export function Hello({ bold }) {
|
||||
return (
|
||||
<div css={["text-center", "font-semibold"]}>
|
||||
<div css={["text-center", bold && "font-semibold"]}>
|
||||
Hello,
|
||||
</div>
|
||||
world!
|
||||
</div>
|
||||
);
|
||||
}
|
||||
`,
|
||||
});
|
||||
|
||||
matchSnapshot(files);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user