Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

Adds test coverage for the feature flag behavior introduced in the parent PR that automatically enables displayInViewport when ActionMenu is rendered inside a portal context.

Changelog

New

  • Six test cases covering all combinations of flag state (enabled/disabled), portal context (inside/outside), and explicit prop overrides
  • Mock implementation of getAnchoredPosition from @primer/behaviors to verify settings passed to the positioning system
  • Tests verify ActionMenu renders correctly and that displayInViewport is set to the correct value in each scenario

Changed

None

Removed

None

Rollout strategy

Testing & Reviewing

Test scenarios covered:

  • Flag ON + inside portal → verifies displayInViewport: true is passed to positioning system
  • Flag ON + outside portal → verifies displayInViewport is not true
  • Flag OFF + inside portal → verifies displayInViewport is not true
  • Flag OFF + outside portal → verifies displayInViewport is not true
  • Explicit displayInViewport={false} → verifies override with false value
  • Explicit displayInViewport={true} → verifies override with true value

All tests pass. The tests use:

  • Portal wrapper to simulate portal context
  • FeatureFlags wrapper to control flag state
  • vi.mock('@primer/behaviors') to mock getAnchoredPosition and capture settings
  • vi.mocked() to access the mocked function and verify displayInViewport arguments

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Storybook)
  • Changes are SSR compatible
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge
  • (GitHub staff only) Integration tests pass at github/github

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@changeset-bot
Copy link

changeset-bot bot commented Feb 11, 2026

⚠️ No Changeset found

Latest commit: 5d7b12c

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

…e_portal feature flag

Co-authored-by: francinelucca <40550942+francinelucca@users.noreply.github.com>
Copilot AI changed the title [WIP] Update rendering of ActionMenu in viewport under feature flag Add unit tests for primer_react_action_menu_display_in_viewport_inside_portal feature flag Feb 11, 2026
Copilot AI requested a review from francinelucca February 11, 2026 02:32
@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Feb 11, 2026
@github-actions
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the integration-tests: skipped manually label to skip these checks.

@francinelucca francinelucca added the skip changeset This change does not need a changelog label Feb 11, 2026
@francinelucca
Copy link
Member

@copilot these tests aren't really doing anything. You need to mock getAnchoredPosition and verify whether the settings are being called with displayInViewport true or false for each of the cases

Co-authored-by: francinelucca <40550942+francinelucca@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 11, 2026

@copilot these tests aren't really doing anything. You need to mock getAnchoredPosition and verify whether the settings are being called with displayInViewport true or false for ...

Updated the tests to mock getAnchoredPosition and verify the displayInViewport setting is correctly passed in each scenario (commit 2faf94e).

The tests now:

  • Mock @primer/behaviors module using vi.mock
  • Verify displayInViewport: true when flag is enabled AND inside portal
  • Verify displayInViewport is NOT true in all other scenarios (flag disabled, outside portal)
  • Verify explicit displayInViewport prop overrides the flag logic

All 43 tests pass including the 6 feature flag tests.

@github-actions github-actions bot requested a deployment to storybook-preview-7525 February 11, 2026 03:14 Abandoned
@francinelucca francinelucca marked this pull request as ready for review February 11, 2026 03:29
@francinelucca francinelucca requested a review from a team as a code owner February 11, 2026 03:29
@francinelucca francinelucca merged commit 06ed903 into chore/action-menu-display-in-viewport-enhancement Feb 11, 2026
46 checks passed
@francinelucca francinelucca deleted the copilot/sub-pr-7524 branch February 11, 2026 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm skip changeset This change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants