Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
57 changes: 4 additions & 53 deletions packages/tailwindcss/src/candidate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -828,40 +828,17 @@ it('should parse a utility with an arbitrary value that is important', () => {
`)
})

it('should parse a utility with an implicit variable as the arbitrary value', () => {
let utilities = new Utilities()
utilities.functional('bg', () => [])

expect(run('bg-[var(--value)]', { utilities })).toMatchInlineSnapshot(`
[
{
"important": false,
"kind": "functional",
"modifier": null,
"raw": "bg-[var(--value)]",
"root": "bg",
"value": {
"dataType": null,
"kind": "arbitrary",
"value": "var(--value)",
},
"variants": [],
},
]
`)
})

it('should parse a utility with an implicit variable as the arbitrary value that is important', () => {
let utilities = new Utilities()
utilities.functional('bg', () => [])

expect(run('bg-[var(--value)]!', { utilities })).toMatchInlineSnapshot(`
expect(run('bg-(--value)!', { utilities })).toMatchInlineSnapshot(`
[
{
"important": true,
"kind": "functional",
"modifier": null,
"raw": "bg-[var(--value)]!",
"raw": "bg-(--value)!",
"root": "bg",
"value": {
"dataType": null,
Expand Down Expand Up @@ -1009,32 +986,6 @@ it('should not parse invalid arbitrary values in variants', () => {
}
})

it('should parse a utility with an implicit variable as the modifier', () => {
let utilities = new Utilities()
utilities.functional('bg', () => [])

expect(run('bg-red-500/[var(--value)]', { utilities })).toMatchInlineSnapshot(`
[
{
"important": false,
"kind": "functional",
"modifier": {
"kind": "arbitrary",
"value": "var(--value)",
},
"raw": "bg-red-500/[var(--value)]",
"root": "bg",
"value": {
"fraction": null,
"kind": "named",
"value": "red-500",
},
"variants": [],
},
]
`)
})

it('should properly decode escaped underscores but not convert underscores to spaces for CSS variables in arbitrary positions', () => {
let utilities = new Utilities()
utilities.functional('flex', () => [])
Expand Down Expand Up @@ -1371,7 +1322,7 @@ it('should parse a utility with an implicit variable as the modifier that is imp
let utilities = new Utilities()
utilities.functional('bg', () => [])

expect(run('bg-red-500/[var(--value)]!', { utilities })).toMatchInlineSnapshot(`
expect(run('bg-red-500/(--value)!', { utilities })).toMatchInlineSnapshot(`
[
{
"important": true,
Expand All @@ -1380,7 +1331,7 @@ it('should parse a utility with an implicit variable as the modifier that is imp
"kind": "arbitrary",
"value": "var(--value)",
},
"raw": "bg-red-500/[var(--value)]!",
"raw": "bg-red-500/(--value)!",
"root": "bg",
"value": {
"fraction": null,
Expand Down
4 changes: 2 additions & 2 deletions packages/tailwindcss/src/css-functions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1118,14 +1118,14 @@ describe('theme(…)', () => {
`)
})

test('theme("--color-red-500")', async () => {
test("theme('--color-red-500')", async () => {
expect(
await compileCss(css`
@theme {
--color-red-500: #f00;
}
.red {
color: theme(--color-red-500);
color: theme('--color-red-500');
}
`),
).toMatchInlineSnapshot(`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,6 @@ describe('with replacer', () => {
)
})

it('should handle box-shadow with intensity', () => {
let parsed = replaceShadowColors('1px 1px var(--my-color)', replacer)
expect(parsed).toMatchInlineSnapshot(
`"1px 1px var(--tw-shadow-color, oklab(from var(--my-color) l a b / 50%))"`,
)
})

it('should handle four values with intensity and no color value', () => {
let parsed = replaceShadowColors('1px 2px 3px 4px', replacer)
expect(parsed).toMatchInlineSnapshot(
Expand Down