Skip to content

feat: add single-donut Binary story and story tests for donut-binary - #906

Open
c-lamoureux wants to merge 4 commits into
feat/donut-binary-secondary-color-labelsfrom
fix/donut-binary-story-tests
Open

feat: add single-donut Binary story and story tests for donut-binary#906
c-lamoureux wants to merge 4 commits into
feat/donut-binary-secondary-color-labelsfrom
fix/donut-binary-story-tests

Conversation

@c-lamoureux

Copy link
Copy Markdown
Contributor

Description

Follow-up from reviewing #888:

  • Adds a Binary story alongside the existing two-chart Boolean example: a single <Donut isBoolean> using the normal (default) categorical color scheme, matching the design mock (88.3% "Satisfied", pink categorical-600 primary). Proves the secondary-gray override in feat: s2 donut binary #888 works standalone, without requiring a second donut or explicit color overrides.
  • Adds DonutBinary.test.tsx, following the existing Donut.test.tsx pattern (render the story, assert on rendered marks/text), covering:
    • Boolean: each chart's primary segment keeps its explicit color; secondary segment is forced to secondary-gray in both charts.
    • Binary: primary segment renders via the normal color scale; secondary segment is still forced to secondary-gray; center-hole value and label render correctly.

Notes

  • isBoolean's summary value format is hardcoded to .0% (0 decimals) in donutSummaryUtils.ts, so 0.883 renders as 88%, not 88.3% as in the design mock. The Binary test asserts the actual current behavior (88%). This predates this PR (and feat: s2 donut binary #888) and isn't fixed here — separate from numberFormat, which is already threaded through for the non-boolean summary path but not the boolean one. Worth a follow-up issue.

How Has This Been Tested?

  • yarn test --testPathPattern="DonutBinary" — 6/6 passing
  • Verified visually in Storybook (Donut/Features/Binary and Boolean)

madelineluke and others added 4 commits August 27, 2026 14:52
…ry segment

The isBoolean (2-segment) donut always rendered its secondary arc via
the normal categorical color scale instead of the fixed
chart.donut.color.secondary-gray token the design requires, so
consumers had to manually pass a gray color as a workaround. The
secondary segment now always resolves to secondary-gray, matching the
same fixed-token precedent already used for the empty-state ring.

Revised the donut-binary spec after confirming the skill's "only the
primary segment is labeled" note describes the existing center-hole
DonutSummary value, not the outside-ring SegmentLabel component -
SegmentLabel remains intentionally suppressed for binary donuts.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Reconciled against the final diff (donutUtils.ts/test.ts, DonutBinary.story.tsx)
- implementationPlan, crossCutting, and edgeCases already matched, so this
only flips status and moves the file into planning/specs/donut/implemented/.
@madelineluke
madelineluke force-pushed the feat/donut-binary-secondary-color-labels branch from 6c34a41 to 20ae969 Compare September 8, 2026 21:48
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.

2 participants