Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tweak tests
Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
  • Loading branch information
thecrypticace and adamwathan committed Sep 17, 2024
commit 3fc1fa3fc23e4a3c0cd0bf7d9646e772321f9f28
27 changes: 26 additions & 1 deletion packages/tailwindcss/src/css-functions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -607,11 +607,36 @@ describe('theme function', () => {
`)
})

test('values that dont exist dont produce candidates', async () => {
test("values that don't exist don't produce candidates", async () => {
// This guarantees that valid candidates still make it through when some are invalid
expect(
await compileCss(
css`
@tailwind utilities;
@theme reference {
--radius-sm: 2rem;
}
`,
[
'rounded-[theme(--radius-sm)]',
'rounded-[theme(i.do.not.exist)]',
'rounded-[theme(--i-do-not-exist)]',
],
),
).toMatchInlineSnapshot(`
".rounded-\\[theme\\(--radius-sm\\)\\] {
border-radius: 2rem;
}"
`)

// This guarantees no output for the following candidates
expect(
await compileCss(
css`
@tailwind utilities;
@theme reference {
--radius-sm: 2rem;
}
`,
['rounded-[theme(i.do.not.exist)]', 'rounded-[theme(--i-do-not-exist)]'],
),
Expand Down