Skip to content

CircularSpinner: convert to functional component + default testId#3076

Draft
michaelmendoza42 wants to merge 2 commits into
mainfrom
mm-201
Draft

CircularSpinner: convert to functional component + default testId#3076
michaelmendoza42 wants to merge 2 commits into
mainfrom
mm-201

Conversation

@michaelmendoza42
Copy link
Copy Markdown

Summary

  • Migrate CircularSpinner from a class component to a functional component.
  • Move data-testid from the inner <svg> to the root wrapping <div> and default it to "circular-spinner".
  • Drop the unused AriaProps from the public prop type (they were declared but never forwarded to any element).
  • Add unit tests covering testId placement/defaults, size→dimension mapping, light/dark fill, and style forwarding.

Bumped as a minor since the data-testid location move and the new always-on default are observable changes for consumers.

Test plan

  • pnpm jest packages/wonder-blocks-progress-spinner passes
  • pnpm typecheck passes
  • Verify Button's loading spinner still renders/identifies correctly (Button always passes an explicit testId, so the new default should not collide)
  • Spot-check the CircularSpinner stories in Storybook

🤖 Generated with Claude Code

Migrates CircularSpinner from a class component to a functional component.
Moves `data-testid` from the inner `<svg>` to the root wrapping `<div>` and
defaults it to `"circular-spinner"`. Also drops the unused `AriaProps` from
the public prop type (they were declared but never forwarded), and adds unit
tests covering testId placement/defaults, size→dimension mapping, light/dark
fill, and `style` forwarding.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 27, 2026

🦋 Changeset detected

Latest commit: e8670f3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@khanacademy/wonder-blocks-progress-spinner Minor
@khanacademy/wonder-blocks-button Patch
@khanacademy/wonder-blocks-banner Patch
@khanacademy/wonder-blocks-tabs Patch
eslint-plugin-wonder-blocks-demo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

Size Change: -71 B (-0.06%)

Total Size: 127 kB

📦 View Changed
Filename Size Change
packages/wonder-blocks-progress-spinner/dist/es/index.js 1.41 kB -71 B (-4.81%)
ℹ️ View Unchanged
Filename Size
packages/eslint-plugin-wonder-blocks/dist/es/index.js 5.57 kB
packages/wonder-blocks-accordion/dist/es/index.js 3.02 kB
packages/wonder-blocks-announcer/dist/es/index.js 2.43 kB
packages/wonder-blocks-badge/dist/es/index.js 2.03 kB
packages/wonder-blocks-banner/dist/es/index.js 2.01 kB
packages/wonder-blocks-birthday-picker/dist/es/index.js 1.93 kB
packages/wonder-blocks-breadcrumbs/dist/es/index.js 761 B
packages/wonder-blocks-button/dist/es/index.js 4.28 kB
packages/wonder-blocks-card/dist/es/index.js 1.09 kB
packages/wonder-blocks-cell/dist/es/index.js 2.19 kB
packages/wonder-blocks-clickable/dist/es/index.js 2.61 kB
packages/wonder-blocks-core/dist/es/index.js 2.6 kB
packages/wonder-blocks-data/dist/es/index.js 5.48 kB
packages/wonder-blocks-date-picker/dist/es/index.js 8.06 kB
packages/wonder-blocks-dropdown/dist/es/index.js 19.7 kB
packages/wonder-blocks-form/dist/es/index.js 6.32 kB
packages/wonder-blocks-grid/dist/es/index.js 1.25 kB
packages/wonder-blocks-icon-button/dist/es/index.js 4.01 kB
packages/wonder-blocks-icon/dist/es/index.js 1.91 kB
packages/wonder-blocks-labeled-field/dist/es/index.js 3.47 kB
packages/wonder-blocks-layout/dist/es/index.js 1.69 kB
packages/wonder-blocks-link/dist/es/index.js 1.54 kB
packages/wonder-blocks-modal/dist/es/index.js 7.36 kB
packages/wonder-blocks-pill/dist/es/index.js 1.31 kB
packages/wonder-blocks-popover/dist/es/index.js 4.4 kB
packages/wonder-blocks-search-field/dist/es/index.js 1.1 kB
packages/wonder-blocks-styles/dist/es/index.js 464 B
packages/wonder-blocks-switch/dist/es/index.js 1.55 kB
packages/wonder-blocks-tabs/dist/es/index.js 5.66 kB
packages/wonder-blocks-testing-core/dist/es/index.js 3.25 kB
packages/wonder-blocks-testing/dist/es/index.js 978 B
packages/wonder-blocks-theming/dist/es/index.js 384 B
packages/wonder-blocks-timing/dist/es/index.js 1.53 kB
packages/wonder-blocks-tokens/dist/es/index.js 5.36 kB
packages/wonder-blocks-toolbar/dist/es/index.js 921 B
packages/wonder-blocks-tooltip/dist/es/index.js 6.06 kB
packages/wonder-blocks-typography/dist/es/index.js 1.58 kB

compressed-size-action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

npm Snapshot: Published

🎉 Good news!! We've packaged up the latest commit from this PR (30e98a0) and published all packages with changesets to npm.

You can install the packages in frontend by running:

./dev/tools/deploy_wonder_blocks.js --tag="PR3076"

Packages can also be installed manually by running:

pnpm add @khanacademy/wonder-blocks-<package-name>@PR3076

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

A new build was pushed to Chromatic! 🚀

https://5e1bf4b385e3fb0020b7073c-kuaeunrlsw.chromatic.com/

Chromatic results:

Metric Total
Captured snapshots 0
Tests with visual changes 1
Total stories 845
Inherited (not captured) snapshots [TurboSnap] 479
Tests on the build 479

The size and light/dark fill tests reached into the rendered tree via
`container.querySelector("svg"|"path")`, which trips
`testing-library/no-container` and `testing-library/no-node-access`. Those
behaviors are unchanged by this PR and already covered by Chromatic
snapshots, so they don't pull their weight as regression guards here.

Also switched the remaining `style` test from `marginTop` to
`marginBlockStart` for the RTL-logical-properties rule.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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