Skip to content

test(ContextMenu): controlled/uncontrolled open switch (#1825)#2082

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

test(ContextMenu): controlled/uncontrolled open switch (#1825)#2082
kotAPI wants to merge 1 commit into
mainfrom
test/issue-1825-contextmenu-controlled-switch

Conversation

@kotAPI

@kotAPI kotAPI commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

add controlled/uncontrolled open switch regression tests

Test plan

  • Related unit tests pass locally

Related to #1825

Summary by CodeRabbit

  • Tests
    • Added coverage for switching the context menu between controlled and uncontrolled open states.
    • Verified the menu closes correctly when moving to controlled mode and responds to right-click actions as expected.
    • Confirmed state updates properly when switching back from controlled to uncontrolled mode.

@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3e895a2

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: 1aae790e-fb1b-4215-b91c-49464ebf093e

📥 Commits

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

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

📝 Walkthrough

Walkthrough

A new test file ContextMenu.controlledSwitch.test.tsx is added with two React Testing Library tests. The tests verify ContextMenu behavior when switching between uncontrolled (defaultOpen) and controlled (open) prop modes, asserting content visibility and onOpenChange callback invocation on right-click.

Changes

ContextMenu Controlled Switch Tests

Layer / File(s) Summary
Controlled/uncontrolled open prop transition tests
src/components/ui/ContextMenu/tests/ContextMenu.controlledSwitch.test.tsx
Two tests cover switching from defaultOpen: true to controlled open: false (asserting content disappears and right-click fires onOpenChange(true)), and switching from controlled open back to uncontrolled defaultOpen (asserting content presence toggles across rerenders).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • mrkazmi333

Poem

🐇 Hop left, hop right, controlled or free,
The menu opens — test to see!
A right-click here, a callback there,
defaultOpen floating in the air.
The rabbit checks each render's state,
And certifies the switch is great! 🥕

🚥 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 describes the added ContextMenu test coverage for controlled/uncontrolled open-state 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-contextmenu-controlled-switch

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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