diff --git a/desktop/frontend-next/src/ui/cards/ToolOutput.tsx b/desktop/frontend-next/src/ui/cards/ToolOutput.tsx index ae2cabfcff..855cc2f1da 100644 --- a/desktop/frontend-next/src/ui/cards/ToolOutput.tsx +++ b/desktop/frontend-next/src/ui/cards/ToolOutput.tsx @@ -298,7 +298,7 @@ function Clip({ id, deps, children }: { id?: string; deps?: unknown; children: R // Collapsing now takes time, and mid-transition this measures an intermediate // height — at that instant the test flips to "not overflowing" and pulls the // expand button. While one is running, wait for it to settle. - if (!el.getAnimations().length) measure(); + if (!el.getAnimations?.().length) measure(); }); el.addEventListener("transitionend", measure); return () => { diff --git a/desktop/frontend-next/src/ui/image-preview.interaction.test.tsx b/desktop/frontend-next/src/ui/image-preview.interaction.test.tsx index c33a9850e9..050f74a2cb 100644 --- a/desktop/frontend-next/src/ui/image-preview.interaction.test.tsx +++ b/desktop/frontend-next/src/ui/image-preview.interaction.test.tsx @@ -1,6 +1,6 @@ // @vitest-environment jsdom import "./testkit"; -import { afterEach, describe, expect, it, vi } from "vitest"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { UserCard } from "./cards/UserCard"; @@ -12,6 +12,8 @@ import type { AgentPort, SessionStatus } from "../port/port"; Element.prototype.getAnimations ??= () => []; +// jsdom has no pointer capture, which the viewer takes when a drag starts. +beforeEach(() => { HTMLElement.prototype.setPointerCapture = vi.fn(); }); afterEach(() => { cleanup(); vi.restoreAllMocks(); }); const path = ".reasonix/attachments/preview.png";