Skip to content

Commit 882fa5f

Browse files
committed
add circular dependency test with multiple levels
1 parent b9b445e commit 882fa5f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

packages/tailwindcss/src/utilities.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17409,4 +17409,33 @@ describe('custom utilities', () => {
1740917409
`[Error: You cannot \`@apply\` the \`hover:bar\` utility here because it creates a circular dependency.]`,
1741017410
)
1741117411
})
17412+
17413+
test('custom utilities with `@apply` causing circular dependencies should error (multiple levels)', async () => {
17414+
await expect(() =>
17415+
compileCss(
17416+
css`
17417+
body {
17418+
@apply foo;
17419+
}
17420+
17421+
@utility foo {
17422+
@apply flex-wrap hover:bar;
17423+
}
17424+
17425+
@utility bar {
17426+
@apply flex dark:baz;
17427+
}
17428+
17429+
@utility baz {
17430+
@apply flex-wrap hover:foo;
17431+
}
17432+
17433+
@tailwind utilities;
17434+
`,
17435+
['foo', 'bar'],
17436+
),
17437+
).rejects.toThrowErrorMatchingInlineSnapshot(
17438+
`[Error: You cannot \`@apply\` the \`hover:bar\` utility here because it creates a circular dependency.]`,
17439+
)
17440+
})
1741217441
})

0 commit comments

Comments
 (0)