From c361835bfcb9fed96d2a02584f37b4eac8177cef Mon Sep 17 00:00:00 2001 From: "paseo-bot[bot]" <266920839+paseo-bot[bot]@users.noreply.github.com> Date: Fri, 6 Nov 2026 18:19:17 +0000 Subject: [PATCH] test(app): cover overlapping floating panel host lifetimes Exercise surviving host measurement through real portal components after the newest host unmounts. Co-authored-by: likaixuan --- .../floating-panel-overlap.browser.test.tsx | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 packages/app/src/components/ui/floating-panel-overlap.browser.test.tsx diff --git a/packages/app/src/components/ui/floating-panel-overlap.browser.test.tsx b/packages/app/src/components/ui/floating-panel-overlap.browser.test.tsx new file mode 100644 index 0000000000..ae96ccecee --- /dev/null +++ b/packages/app/src/components/ui/floating-panel-overlap.browser.test.tsx @@ -0,0 +1,40 @@ +import React, { act } from "react"; +import { createRoot } from "react-dom/client"; +import { describe, expect, test } from "vitest"; +import { Portal, PortalProvider } from "@gorhom/portal"; +import { FloatingPanelPortalHost, measureFloatingPanelPortalHost } from "./floating-panel-portal"; + +describe("Floating panel host lifetime", () => { + test("removing the newest host preserves the surviving host measurement", async () => { + const container = document.createElement("div"); + container.style.cssText = "position:relative;width:800px;height:600px"; + document.body.appendChild(container); + const root = createRoot(container); + function Content({ overlap }: { overlap: boolean }) { + return ( + + + {overlap && } + +
Commands
+
+
+ ); + } + try { + await act(async () => root.render()); + expect(await measureFloatingPanelPortalHost("workspace")).toMatchObject({ + width: 800, + height: 600, + }); + await act(async () => root.render()); + expect(await measureFloatingPanelPortalHost("workspace")).toMatchObject({ + width: 800, + height: 600, + }); + } finally { + await act(async () => root.unmount()); + container.remove(); + } + }); +});