/* ! * (c) Copyright 2026 Palantir Technologies Inc. All rights reserved. */ import { render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { createRef, useState } from "react"; import { afterAll, beforeEach, describe, expect, it, vi } from "@blueprintjs/test-commons/vitest"; import { Classes, mergeRefs } from "../../common"; import * as Errors from "../../common/errors"; import { Button, Dialog, DialogBody, InputGroup, PopupKind, Tooltip } from "../../components"; import type { PopoverInteractionKind } from "../popover/popoverProps"; import { PopoverNext } from "./popoverNext"; describe("", () => { describe("validation", () => { const warnSpy = vi.spyOn(console, "warn").mockImplementation(vi.fn()); beforeEach(() => warnSpy.mockClear()); afterAll(() => warnSpy.mockRestore()); it("throws error if given no target", () => { render(); expect(warnSpy).toHaveBeenCalledWith(Errors.POPOVER_REQUIRES_TARGET); }); it("warns if given > 1 target elements", () => { render( } shouldReturnFocusOnClose={true} usePortal={false} > } shouldReturnFocusOnClose={false} usePortal={false} > } isOpen={true} onClose={onClose} > } isOpen={true} onInteraction={onInteraction} > } defaultIsOpen={true}> } defaultIsOpen={true} usePortal={true} > } defaultIsOpen={true} usePortal={false} > } defaultIsOpen={true} > } defaultIsOpen={true} > } defaultIsOpen={true} > { seenRefs.add(ref); return