diff --git a/ui/src/components/IssueRowDetailsNotice.test.tsx b/ui/src/components/IssueRowDetailsNotice.test.tsx new file mode 100644 index 00000000000..3382dcd5ff2 --- /dev/null +++ b/ui/src/components/IssueRowDetailsNotice.test.tsx @@ -0,0 +1,52 @@ +// @vitest-environment jsdom +import { act } from "react"; +import { createRoot } from "react-dom/client"; +import { describe, expect, it, vi } from "vitest"; +import { IssueRowDetailsNotice } from "./IssueRowDetailsNotice"; + +vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true); + +describe("IssueRowDetailsNotice", () => { + it("returns null when there is no error", () => { + const container = document.createElement("div"); + const root = createRoot(container); + try { + act(() => root.render()); + expect(document.body.querySelector('[role="alert"]')).toBeNull(); + } finally { + act(() => root.unmount()); + } + }); + + it("clears MobileBottomNav on mobile, constrains horizontal fit, and triggers retry", () => { + const onRetry = vi.fn(); + const container = document.createElement("div"); + const root = createRoot(container); + try { + act(() => + root.render( + , + ), + ); + const alert = document.body.querySelector('[role="alert"]') as HTMLElement | null; + expect(alert).not.toBeNull(); + const classes = alert!.className.split(/\s+/); + expect(classes).toContain("inset-x-4"); + expect(classes).toContain("bottom-(--mobile-nav-overlay-bottom)"); + expect(classes).toContain("md:bottom-4"); + expect(classes).toContain("sm:left-auto"); + expect(classes).toContain("sm:right-4"); + expect(classes).toContain("flex-wrap"); + + const retryButton = alert!.querySelector("button"); + expect(retryButton?.textContent).toBe("Retry details"); + act(() => retryButton?.click()); + expect(onRetry).toHaveBeenCalledTimes(1); + } finally { + act(() => root.unmount()); + } + }); +}); diff --git a/ui/src/components/IssueRowDetailsNotice.tsx b/ui/src/components/IssueRowDetailsNotice.tsx index f4c7ddf27f0..07e54d66894 100644 --- a/ui/src/components/IssueRowDetailsNotice.tsx +++ b/ui/src/components/IssueRowDetailsNotice.tsx @@ -10,9 +10,12 @@ export function IssueRowDetailsNotice({ error, onRetry, message = "Some task det }) { if (!error) return null; return createPortal( -
-

{message}

- +
+

{message}

+
, document.body, ); } diff --git a/ui/src/components/ToastViewport.test.tsx b/ui/src/components/ToastViewport.test.tsx index ba63c222db1..5981def0af2 100644 --- a/ui/src/components/ToastViewport.test.tsx +++ b/ui/src/components/ToastViewport.test.tsx @@ -37,3 +37,23 @@ describe("toast session replay", () => { } finally { act(() => root.unmount()); } }); }); + +describe("mobile bottom nav clearance and viewport fit", () => { + it("lifts toasts above MobileBottomNav on mobile and constrains width inside narrow viewports", () => { + const container = document.createElement("div"); + const root = createRoot(container); + try { + act(() => root.render()); + const aside = container.querySelector("aside"); + expect(aside).not.toBeNull(); + const classes = aside!.className.split(/\s+/); + expect(classes).toContain("inset-x-3"); + expect(classes).toContain("sm:inset-x-auto"); + expect(classes).toContain("sm:left-3"); + expect(classes).toContain("sm:w-full"); + expect(classes).toContain("bottom-(--mobile-nav-overlay-bottom)"); + expect(classes).toContain("md:bottom-3"); + expect(classes).not.toContain("w-full"); + } finally { act(() => root.unmount()); } + }); +}); diff --git a/ui/src/components/ToastViewport.tsx b/ui/src/components/ToastViewport.tsx index 4b168064478..ea5acaddaf2 100644 --- a/ui/src/components/ToastViewport.tsx +++ b/ui/src/components/ToastViewport.tsx @@ -114,7 +114,7 @@ export function ToastViewport() {