Skip to content

test(react-grab): cover data-typed branches in CSS/color utils - #503

Closed
aidenybai wants to merge 1 commit into
mainfrom
test/data-typed-util-branches
Closed

test(react-grab): cover data-typed branches in CSS/color utils#503
aidenybai wants to merge 1 commit into
mainfrom
test/data-typed-util-branches

Conversation

@aidenybai

@aidenybai aidenybai commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Summary

Item #3 from the coverage report — the deep branches that only fire for property/color types the e2e suite never feeds. All pure logic, so unit tests are the right tool.

  • css-property-bounds.ts: every property family, including the previously-untaken z-index (line 37) and percent-unit (line 59) arms, plus the value-scaled size ceiling exercised on both sides of its Math.max.
  • parse-any-color.ts: hex expansion (3/4/6/8-digit, optional #), the transparent keyword, and the hand-rolled oklch() converter across all hue units (deg/grad/rad/turn), alpha present/absent, and percent vs number forms. In node there's no <canvas>, so the no-canvas null fall-through is asserted too.
  • css-baseline-measurement.ts: every isDefaultByHeuristic arm (enum font-weight vs first-option, spacing/gap/border/radius/opacity/letter-spacing/z-index zeros, inset never-default, size/line-height always-default, unrecognized fall-through) and the isDefaultByBaseline color / layout-dependent / snapshot-compare / missing-key branches.

The remaining #3 items (tailwind-autoapply.ts enum branches, arrow-navigation, auto-scroll) need a SolidJS createRoot / DOM harness and are left for a follow-up.

Test plan

  • pnpm test:unit — 84 passed on this branch (27 new across 3 files)
  • pnpm --filter react-grab typecheck clean
  • pnpm lint clean

Note

Low Risk
Test-only additions with no runtime or API changes; risk is limited to CI maintenance if assertions drift from intentional utility behavior.

Overview
Adds 27 unit tests across three new files to lock in behavior that e2e coverage rarely hits—no production code changes.

propertyBounds (css-property-bounds.test.ts): opacity, z-index, typography, radius, width/height scaling, inset positions, percent units, and spacing vs margin min/max.

parseAnyColor (parse-any-color.test.ts): blank input, transparent, hex shorthand/expansion, hand-rolled oklch() (alpha, percent forms, hue units), and null when Node has no canvas.

isDefaultByHeuristic / isDefaultByBaseline (css-baseline-measurement.test.ts): enum defaults (font-weight vs first option), zero-based spacing/gap/border/radius/opacity/z-index, inset never-default, size/line-height always-default, snapshot compare, layout-dependent deferral, and missing snapshot keys.

Reviewed by Cursor Bugbot for commit e19269d. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Add targeted unit tests in react-grab to cover data-typed branches the e2e suite doesn’t hit. Improves coverage and confidence across css-property-bounds (z-index, % units, size ceiling scaling), parse-any-color (hex, transparent, oklch() with all hue units and alpha), and css-baseline-measurement (heuristic vs baseline snapshot branches).

Written for commit e19269d. Summary will update on new commits.

Review in cubic

Targets branch gaps the e2e suite never feeds the right input types for:

- css-property-bounds.ts: every property family incl. the z-index and
  percent-unit arms, plus the value-scaled size ceiling (both Math.max sides)
- parse-any-color.ts: hex expansion, the transparent keyword, and the
  hand-rolled oklch() converter across all hue units / alpha / percent forms
  (canvas-free paths; the no-canvas null fall-through is asserted too)
- css-baseline-measurement.ts: every isDefaultByHeuristic arm and the
  isDefaultByBaseline color / layout-dependent / snapshot-compare branches
@vercel

vercel Bot commented Jun 29, 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 29, 2026 12:47am
react-grab-website Ready Ready Preview, Comment Jun 29, 2026 12:47am

@pkg-pr-new

pkg-pr-new Bot commented Jun 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: e19269d

@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 3 files

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