test(react-grab): cover data-typed branches in CSS/color utils - #503
Closed
aidenybai wants to merge 1 commit into
Closed
test(react-grab): cover data-typed branches in CSS/color utils#503aidenybai wants to merge 1 commit into
aidenybai wants to merge 1 commit into
Conversation
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
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
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.
Math.max.#), thetransparentkeyword, and the hand-rolledoklch()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-canvasnullfall-through is asserted too.isDefaultByHeuristicarm (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 theisDefaultByBaselinecolor / layout-dependent / snapshot-compare / missing-key branches.The remaining #3 items (
tailwind-autoapply.tsenum branches,arrow-navigation,auto-scroll) need a SolidJScreateRoot/ 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 typecheckcleanpnpm lintcleanNote
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-rolledoklch()(alpha, percent forms, hue units), andnullwhen 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-grabto cover data-typed branches the e2e suite doesn’t hit. Improves coverage and confidence acrosscss-property-bounds(z-index,%units, size ceiling scaling),parse-any-color(hex,transparent,oklch()with all hue units and alpha), andcss-baseline-measurement(heuristic vs baseline snapshot branches).Written for commit e19269d. Summary will update on new commits.