Skip to content

test(react-grab): unit-test findTailwindClass across all chip scales - #500

Closed
aidenybai wants to merge 1 commit into
mainfrom
test/find-tailwind-class-unit
Closed

test(react-grab): unit-test findTailwindClass across all chip scales#500
aidenybai wants to merge 1 commit into
mainfrom
test/find-tailwind-class-unit

Conversation

@aidenybai

@aidenybai aidenybai commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • findTailwindClass is pure logic, but the edit-panel e2e flow only ever drove its spacing branch — border-width, z-index, and opacity were untested (~64% lines).
  • Adds a vite-plus/test unit 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-key null path.

Pure functions are best covered by unit tests; note these run under vp test and 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 typecheck clean
  • pnpm lint — 0 warnings / 0 errors

Note

Low Risk
Test-only change with no production code modifications.

Overview
Adds a vite-plus/test unit spec for findTailwindClass so 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-less border at 1px vs border-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 findTailwindClass across 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.

Review in cubic

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.
@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-grab-storybook Ready Ready Preview, Comment Jun 28, 2026 10:42am
react-grab-website Ready Ready Preview, Comment Jun 28, 2026 10:42am

@pkg-pr-new

pkg-pr-new Bot commented Jun 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@react-grab/cli@500
npm i https://pkg.pr.new/grab@500
npm i https://pkg.pr.new/react-grab@500

commit: 1216182

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

@aidenybai

Copy link
Copy Markdown
Owner Author

Superseded by #510, which consolidates all the test-coverage PRs into one. Commits preserved there.

@aidenybai aidenybai closed this Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant