test(query-devtools/contexts/PiPContext): add tests for 'closePipWindow' guard and reset#10802
Conversation
…ow' guard and reset
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds test coverage for the ChangesPiP Window Closure Test Suite
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit 1ac4621
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview2 package(s) bumped directly, 23 bumped as dependents. 🟩 Patch bumps
|
size-limit report 📦
|
🎯 Changes
Cover the public
closePipWindowAPI the module exposes throughusePiPWindow().closePipWindow(PiPContext.tsx:40-46). Devtools itself doesn't call it today, but it's part of thePiPContextTypecontract external integrators can call.Three cases pin down the guard and the cleanup it owns:
should be a noop when no window is open: verifies theif (w != null)guard that prevents anull.close()TypeErrorwhen there's no PiP window yet.should call "close" on the opened window and reset the "pipWindow" signal: verifies the happy path —requestPipWindow→closePipWindowcallscloseexactly once and thepipWindowaccessor transitions fromfakeWindow→null(asserted via theobservedarray, matching the"pagehide" lifecyclestyle).should call "close" only once when "closePipWindow" runs twice in a row: verifies the same guard from the post-close lifecycle phase — a second call after the signal is alreadynullmust stay a noop, protecting integrators against accidental double-invocation.✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit