Skip to content

test(CheckboxCards): controlled/uncontrolled value switch (#1825)#2080

Open
kotAPI wants to merge 1 commit into
mainfrom
test/issue-1825-checkboxcards-controlled-switch
Open

test(CheckboxCards): controlled/uncontrolled value switch (#1825)#2080
kotAPI wants to merge 1 commit into
mainfrom
test/issue-1825-checkboxcards-controlled-switch

Conversation

@kotAPI

@kotAPI kotAPI commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

add controlled/uncontrolled value switch regression tests

Test plan

  • Related unit tests pass locally

Related to #1825

Summary by CodeRabbit

  • Tests
    • Added coverage for switching a checkbox card group between uncontrolled and controlled states.
    • Verified the selected state updates correctly when changing from a default selection to a controlled value.
    • Confirmed selection persists as expected after remounting and that user clicks update the checked item and selection callback behavior.

@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a581bb4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c0e5a3be-0a9e-4600-9022-118be3c1faa9

📥 Commits

Reviewing files that changed from the base of the PR and between 56746ce and a581bb4.

📒 Files selected for processing (1)
  • src/components/ui/CheckboxCards/tests/CheckboxCards.controlledSwitch.test.tsx

📝 Walkthrough

Walkthrough

A new test file CheckboxCards.controlledSwitch.test.tsx is added with two async tests. The first verifies that rerendering with a controlled value after an initial defaultValue updates aria-checked and triggers onValueChange with the combined selection. The second verifies that remounting with defaultValue after a controlled value mount reflects the uncontrolled checked state correctly.

Changes

CheckboxCards Controlled Switch Tests

Layer / File(s) Summary
Controlled/uncontrolled switch test suite
src/components/ui/CheckboxCards/tests/CheckboxCards.controlledSwitch.test.tsx
Adds a describe('CheckboxCards controlled switch') block with two async tests: one asserting aria-checked updates and onValueChange(['banana', 'apple']) after a defaultValuevalue rerender, and one asserting correct aria-checked after a controlled→uncontrolled remount.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related issues

Possibly related PRs

  • rad-ui/ui#1239: Covers the same CheckboxCards controlled value/onValueChange and checked-state behavior in the existing main test suite.

Suggested labels

automerge

🐇 A checkbox hopped left, then it hopped right,
From defaultValue to value mid-flight!
With aria-checked true and onValueChange called,
No uncontrolled state went unrecalled.
The bunny ticks boxes with glee — tests pass tonight! ✅

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the change: regression tests for CheckboxCards controlled/uncontrolled value switching.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/issue-1825-checkboxcards-controlled-switch

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage

This report compares the PR with the base branch. "Δ" shows how the PR affects each metric.

Metric PR Δ
Statements 78.2% +0.00%
Branches 60.85% +0.00%
Functions 63.51% +0.00%
Lines 79.79% +0.00%

Coverage improved or stayed the same. Great job!

Run npm run coverage:ci locally for detailed reports and target untested areas to raise these numbers.

@kotAPI

kotAPI commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator Author

Code review

LGTM. Matches project patterns for portal Theme refs, Floating UI prop merge, controlled-switch/lazy-mount/RTL tests, or focused bug fixes. No changes requested.

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