From 46f3fdab0cdb47d8e8ed12be1ed27fda206ca519 Mon Sep 17 00:00:00 2001 From: Luiz Figueiredo Date: Tue, 24 Nov 2026 01:17:38 +0900 Subject: [PATCH] Remove duplicate tests and restore their intended inputs Some tests in packages/tailwindcss had the same body as another test: - candidate.test.ts: the "implicit variable" tests became copies of the "explicit variable" tests when automatic var() injection was removed (#13657). Remove the non-important ones, which the parens shorthand tests already cover, and switch the important ones to the shorthand syntax (`bg-(--value)!`, `bg-red-500/(--value)!`). - css-functions.test.ts: the quoted theme() test used the unquoted syntax. Use `theme('--color-red-500')` so it covers unquoting. - replace-shadow-colors.test.ts: remove a copy of the intensity test that came from splitting the it.each table (#17435). --- packages/tailwindcss/src/candidate.test.ts | 57 ++----------------- .../tailwindcss/src/css-functions.test.ts | 4 +- .../src/utils/replace-shadow-colors.test.ts | 7 --- 3 files changed, 6 insertions(+), 62 deletions(-) diff --git a/packages/tailwindcss/src/candidate.test.ts b/packages/tailwindcss/src/candidate.test.ts index e775fc12c568..a83133b70ef8 100644 --- a/packages/tailwindcss/src/candidate.test.ts +++ b/packages/tailwindcss/src/candidate.test.ts @@ -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, @@ -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', () => []) @@ -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, @@ -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, diff --git a/packages/tailwindcss/src/css-functions.test.ts b/packages/tailwindcss/src/css-functions.test.ts index 8cab2949fd93..24ddb5d1345e 100644 --- a/packages/tailwindcss/src/css-functions.test.ts +++ b/packages/tailwindcss/src/css-functions.test.ts @@ -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(` diff --git a/packages/tailwindcss/src/utils/replace-shadow-colors.test.ts b/packages/tailwindcss/src/utils/replace-shadow-colors.test.ts index 701e80f051ff..fcde53f1dff0 100644 --- a/packages/tailwindcss/src/utils/replace-shadow-colors.test.ts +++ b/packages/tailwindcss/src/utils/replace-shadow-colors.test.ts @@ -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(