Skip to content

Commit 191c544

Browse files
CSS theme(): Add unit test that combines CSS variable syntax with opacity modifier (#14323)
This PR adds a new test case to the branches that test the CSS `theme()` function with the CSS variable syntax. The new case includes an opacity modifier and ensures that the opacity is properly added.
1 parent adc8dfb commit 191c544

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

packages/tailwindcss/src/functions.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,28 @@ describe('theme function', () => {
433433
}"
434434
`)
435435
})
436+
437+
test('theme(--color-red-500 / 50%)', async () => {
438+
expect(
439+
await compileCss(css`
440+
@theme {
441+
--color-red-500: #f00;
442+
}
443+
.red {
444+
color: theme(--color-red-500 / 50%);
445+
}
446+
`),
447+
).toMatchInlineSnapshot(`
448+
":root {
449+
--color-red-500: red;
450+
}
451+
452+
.red {
453+
color: #ff000080;
454+
}"
455+
`)
456+
})
457+
436458
test('theme("--color-red-500")', async () => {
437459
expect(
438460
await compileCss(css`

0 commit comments

Comments
 (0)