Add unit tests for primer_react_action_menu_display_in_viewport_inside_portal feature flag#7525
Conversation
|
…e_portal feature flag Co-authored-by: francinelucca <40550942+francinelucca@users.noreply.github.com>
|
👋 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 |
|
@copilot these tests aren't really doing anything. You need to mock |
Co-authored-by: francinelucca <40550942+francinelucca@users.noreply.github.com>
Updated the tests to mock The tests now:
All 43 tests pass including the 6 feature flag tests. |
… copilot/sub-pr-7524
06ed903
into
chore/action-menu-display-in-viewport-enhancement
Adds test coverage for the feature flag behavior introduced in the parent PR that automatically enables
displayInViewportwhen ActionMenu is rendered inside a portal context.Changelog
New
getAnchoredPositionfrom@primer/behaviorsto verify settings passed to the positioning systemdisplayInViewportis set to the correct value in each scenarioChanged
None
Removed
None
Rollout strategy
Testing & Reviewing
Test scenarios covered:
displayInViewport: trueis passed to positioning systemdisplayInViewportis not truedisplayInViewportis not truedisplayInViewportis not truedisplayInViewport={false}→ verifies override withfalsevaluedisplayInViewport={true}→ verifies override withtruevalueAll tests pass. The tests use:
Portalwrapper to simulate portal contextFeatureFlagswrapper to control flag statevi.mock('@primer/behaviors')to mockgetAnchoredPositionand capture settingsvi.mocked()to access the mocked function and verifydisplayInViewportargumentsMerge checklist
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.