Fix wrapper

This commit is contained in:
Alex
2025-02-10 02:29:07 -05:00
parent 8e41208a14
commit 52b19b3b36
4 changed files with 70 additions and 62 deletions

View File

@ -68,10 +68,29 @@ describe("merges with existing className attribute", () => {
const clsName = getClassName("text-center");
expect(files.js.text).toContain(
`import { composeRenderProps as _composeRenderProps } from "react-aria-component";`
`{ ...props, className: typeof _className === "function" ? (...args) => _cx("${clsName}", _className(...args)) : _cx("${clsName}", _className),`
);
});
it("supports composeRenderProps (2)", async () => {
const { files } = await compileESBuild({
clsx: "clsx",
expectFiles: 2,
composeRenderProps: true,
javascript: /* tsx */ `
export function Hello({ className, ...props }) {
return (
<div className={className} css="text-center">
<span {...props}>Hello, world!</span>
</div>
);
}
`,
});
const clsName = getClassName("text-center");
expect(files.js.text).toContain(
`...props, className: _composeRenderProps(_className, (n) => _cx("${clsName}", n)),`
`{ className: typeof className === "function" ? (...args) => _cx("${clsName}", className(...args)) : _cx("${clsName}", className),`
);
});

View File

@ -52,7 +52,7 @@ export function getBuild(name: string) {
external: [
"react",
"react/jsx-runtime",
"react-aria-component",
"react-aria-components",
"@emotion/css",
"clsx",
"tslib",