Repository navigation
Remove duplicate tests and restore their intended inputs - #20751
Open
figueiredoluiz wants to merge 1 commit into
Open
figueiredoluiz wants to merge 1 commit into
figueiredoluiz wants to merge 1 commit into
Conversation
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 (tailwindlabs#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 (tailwindlabs#17435).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A few tests in
packages/tailwindcsshave the same body as a neighbouring test, so they ran the same check twice. Each pair went that way for a different reason:candidate.test.ts: "implicit variable" tests. These used to cover the automaticvar(…)injection syntax (bg-[--value]). When that syntax was removed in Remove automaticvar(…)injection #13657, their inputs were changed tobg-[var(--value)], which is exactly what the "explicit variable" tests below them check. The implicit syntax is now the parens shorthand (bg-(--value)), so:bg-(--my-color)andbg-red-500/(--value)are already covered byshould parse a utility with an arbitrary value with parensandshould parse a utility with an implicit variable as the modifier using the shorthand.!important"implicit" tests now usebg-(--value)!andbg-red-500/(--value)!. Those inputs had no coverage yet.css-functions.test.ts:theme("--color-red-500"). Its CSS has used the unquotedtheme(--color-red-500)since it was added, so it repeated the test above it. It now uses the quoted form (theme('--color-red-500')), which nothing else tested. The title uses single quotes to match what Prettier writes in the CSS and the other quotedtheme('colors.red.500')tests.replace-shadow-colors.test.ts:should handle box-shadow with intensity. When theit.eachtable was split into separate tests in Improve compatibility with Safari 15 #17435, the one1px 1px var(--my-color)intensity row became two identical tests. One of them is removed.The duplicates were found with vitest-dedup (
duplicate-testrule) and checked by hand againstgit log/git blame.There are no source changes. No changelog entry, because this only touches tests.
Test plan
To confirm the quoted
theme('--color-red-500')test now covers unquoting, I disabledeventuallyUnquote(path)incss-functions.ts. That made this test fail while the unquoted one still passed. I then reverted the change.