feat(cli): update tests

This commit is contained in:
shadcn
2024-08-18 23:35:19 +04:00
parent 30d47cab2f
commit b95ffc2168
5 changed files with 214 additions and 122 deletions

View File

@@ -34,6 +34,14 @@ describe("transformTailwindCss", () => {
--background: black;
--foreground: white
}
}
@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}
"
`)
@@ -82,6 +90,74 @@ describe("transformTailwindCss", () => {
--foreground: 60 9.1% 97.8%;
}
}
@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}
"
`)
})
test("should not add the base layer if it is already present", async () => {
expect(
await transformTailwindCss(
`@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base{
:root{
--background: 210 40% 98%;
}
.dark{
--background: 222.2 84% 4.9%;
}
}
@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}
`,
{}
)
).toMatchInlineSnapshot(`
"@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base{
:root{
--background: 210 40% 98%;
}
.dark{
--background: 222.2 84% 4.9%;
}
}
@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}
"
`)
})