+
+ {{ true ? 123 as number : 0 }}
+
+
+
+
+ `,
+ config: {},
+ })
+ expect(result).toMatchSnapshot()
+ })
+
it('defineProps', async () => {
const result = await transform({
filename: 'app.vue',
diff --git a/packages/cli/test/utils/transform-tw-prefix.test.ts b/packages/cli/test/utils/transform-tw-prefix.test.ts
index 91d806da2..f565fa1f8 100644
--- a/packages/cli/test/utils/transform-tw-prefix.test.ts
+++ b/packages/cli/test/utils/transform-tw-prefix.test.ts
@@ -1,111 +1,146 @@
-import { it } from 'vitest'
+import { expect, it } from 'vitest'
+import { transform } from '../../src/utils/transformers'
+import { applyPrefixesCss } from '../../src/utils/transformers/transform-tw-prefix'
it('transform tailwind prefix', async () => {
- // expect(
- // await transform({
- // filename: 'test.ts',
- // raw: `const testVariants = cva(
- // 'bg-background hover:bg-muted text-primary-foreground sm:focus:text-accent-foreground',
- // {
- // variants: {
- // variant: {
- // default: 'bg-primary text-primary-foreground hover:bg-primary/90',
- // },
- // size: {
- // default: 'h-10 px-4 py-2',
- // },
- // },
- // },
- // )`,
- // config: {
- // tailwind: {
- // baseColor: 'stone',
- // prefix: 'tw-',
- // },
- // aliases: {
- // components: '@/components',
- // utils: '@/lib/utils',
- // },
- // },
- // baseColor: 'stone',
- // }),
- // ).toMatchSnapshot()
+ expect(
+ await transform({
+ filename: 'test.ts',
+ raw: `import { cva } from "class-variance-authority"
+ export { default as Button } from "./Button.vue"
+ export type { ButtonType } from "./Button.vue"
+
+ export const testVariants = cva(
+ 'bg-background hover:bg-muted text-primary-foreground sm:focus:text-accent-foreground',
+ {
+ variants: {
+ variant: {
+ default: 'bg-primary text-primary-foreground hover:bg-primary/90',
+ },
+ size: {
+ default: 'h-10 px-4 py-2',
+ },
+ },
+ defaultVariants: {
+ variant: 'default',
+ },
+ },
+ )`,
+ config: {
+ tailwind: {
+ baseColor: 'stone',
+ prefix: 'tw-',
+ },
+ aliases: {
+ components: '@/components',
+ utils: '@/lib/utils',
+ },
+ typescript: true,
+ },
+ baseColor: 'stone',
+ }),
+ ).toMatchSnapshot()
- // expect(
- // await transform({
- // filename: 'app.vue',
- // raw: `