Skip to content

Commit c8968bb

Browse files
committed
add additional test to verify that we don't inject unnecessary @layers
1 parent 4cf5ace commit c8968bb

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

packages/@tailwindcss-upgrade/src/codemods/migrate-missing-layers.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,32 @@ it('should not migrate already migrated `@import` at-rules', async () => {
2222
).toMatchInlineSnapshot(`"@import 'tailwindcss';"`)
2323
})
2424

25+
it('should not migrate anything if no `@tailwind` directives (or imports) are found', async () => {
26+
expect(
27+
await migrate(css`
28+
/* Base */
29+
html {
30+
color: red;
31+
}
32+
33+
/* Utilities */
34+
.foo {
35+
color: blue;
36+
}
37+
`),
38+
).toMatchInlineSnapshot(`
39+
"/* Base */
40+
html {
41+
color: red;
42+
}
43+
44+
/* Utilities */
45+
.foo {
46+
color: blue;
47+
}"
48+
`)
49+
})
50+
2551
it('should not wrap comments in a layer, if they are the only nodes', async () => {
2652
expect(
2753
await migrate(css`

0 commit comments

Comments
 (0)