test(query-devtools/contexts/PiPContext): add tests for the 'pip_open' auto-open createEffect#10803
Conversation
…' auto-open createEffect
|
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)
📝 WalkthroughWalkthroughTest file extends the PiP test harness to isolate state via localStorage cleanup and adds a comprehensive test suite validating pip_open auto-open behavior, including triggering on mount, suppression when disabled, error logging on null returns, and exception propagation. ChangesPiP Auto-open Test Coverage
Possibly related PRs
Suggested labels
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 33837a3
☁️ 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 four branches of the auto-open
createEffectatPiPContext.tsx:136-154. This is the effect that restores PiP state after a reload (and the oneDevtoolsPanelComponentdeliberately disables), so each branch maps to a real user / integrator scenario:should auto-open a PiP window when "pip_open" is "true" on mount: verifies the reload-restore path —localStorage.pip_open === 'true'triggersrequestPipWindow(and thereforewindow.open) on the very first effect run.should not auto-open a PiP window when "disabled" is true: verifies thedisabledshort-circuit thatDevtoolsPanelComponentrelies on (<PiPProvider disabled>so the panel-only mode never auto-spawns a PiP popup).should reset "pip_open"/"open" and log when "window.open" returns null on auto-open: verifies the popup-blocker recovery path —window.openreturningnullmakesrequestPipWindowthrowPipOpenError, which the effect catches, logs toconsole.error, and uses to reset bothpip_openandopenso the next reload doesn't loop into the same failure.should re-throw non-"PipOpenError" errors from "window.open" on auto-open: verifies that unexpectedwindow.openfailures (anything other thanPipOpenError) are surfaced instead of being silently swallowed by thetry/catch.The
renderAndActhelper gains a smallinitialStorageoption (and a matchinglocalStorage.clear()inafterEach) so each case can seedpip_open/openbefore mount without leaking state into siblings. The emptyactioncallback is intentional — these cases assert on the effect that runs at mount, not on anything the actor does afterward.✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit