test(query-devtools/contexts/PiPContext): add tests for 'requestPipWindow' copying parent stylesheets into the PiP document head#10800
Conversation
…ndow' copying parent stylesheets into the PiP document head
|
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 a test suite verifying how ChangesPiP stylesheet propagation tests
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
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 3bf50d2
☁️ 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 three branches of the stylesheet copy loop in
requestPipWindow(PiPContext.tsx:85-117) — the logic the module owns to make Devtools render styled inside the popup that wouldn't otherwise inherit any parent CSS:should copy parent stylesheets as "<style>" with the same id into the PiP document head: verifies the same-origin path —cssTextis concatenated into a new<style>and the sourceidis propagated so goober's#_goobermirror keeps working.should fall back to a "<link>" for cross-origin stylesheets whose "cssRules" throw: verifies the cross-origin path — when readingcssRulesraises (Google Fonts, CDN-served CSS), the module reattaches the samehrefas a<link>so the popup can still load it.should skip the "<link>" fallback when the cross-origin stylesheet has no "href": verifies thehref == nullguard that prevents an empty<link>from being appended.A small
stubParentStyleSheet(sheet)helper plus aFakeStyleSheettype wrapsvi.spyOn(document, 'styleSheets', 'get')so each case only declares the fields the production loop actually reads (cssRules,href,type,media,ownerNode). AmakeCssRules(...cssTexts)helper builds theArrayLikeshape the production spread expects without anas unknown as CSSRuleListcast at the call sites.✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit