test(react-grab): unit-test findTailwindClass across all chip scales - #500
Closed
aidenybai wants to merge 1 commit into
Closed
test(react-grab): unit-test findTailwindClass across all chip scales#500aidenybai wants to merge 1 commit into
aidenybai wants to merge 1 commit into
Conversation
Covers the border-width, z-index, and opacity branches (plus spacing edge cases and the unknown-key path) that the edit-panel e2e flow never drove, including the 1px suffix-less border form and the off-step/out-of-range rejections.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
4 tasks
Owner
Author
|
Superseded by #510, which consolidates all the test-coverage PRs into one. Commits preserved there. |
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
findTailwindClassis pure logic, but the edit-panel e2e flow only ever drove its spacing branch — border-width, z-index, and opacity were untested (~64% lines).vite-plus/testunit spec covering all four chip scales plus edge cases: the 1px suffix-less border form (border/border-t), numeric-suffix widths, z-index range, the opacity 5%-step rule, negative / non-integer / out-of-range / non-finite rejections, aggregate row prefixes (py,size,inset), and the unknown-keynullpath.Pure functions are best covered by unit tests; note these run under
vp testand so don't move the Playwright V8 e2e report, but they close the real logic gap deterministically.Test plan
pnpm test:unit— 69 passed (9 files)pnpm typecheckcleanpnpm lint— 0 warnings / 0 errorsNote
Low Risk
Test-only change with no production code modifications.
Overview
Adds a
vite-plus/testunit spec forfindTailwindClassso chip mapping logic is covered outside the edit-panel e2e path, which previously exercised mostly spacing.The tests lock in behavior for all four chip scales—spacing (4px units, aggregate keys like
py/size/inset), border-width (suffix-lessborderat 1px vsborder-N), z-index, and opacity (5% steps)—plus rejections for unknown keys, negatives, non-integers, out-of-range values, and non-finite opacity inputs.Reviewed by Cursor Bugbot for commit 1216182. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Add unit tests for
findTailwindClassacross spacing, border-width, z-index, and opacity scales to ensure correct class mapping and edge-case handling. Covers 1px suffix-less borders, 5% opacity steps, aggregate prefixes (py,size,inset), invalid values, and unknown keys that e2e tests missed.Written for commit 1216182. Summary will update on new commits.