import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, it, vi } from "vitest"; import { PullDropdown } from "./changes-panel-header"; vi.mock("@kandev/ui/button", () => ({ Button: ({ children, ...props }: React.ButtonHTMLAttributes) => ( ), })); vi.mock("@kandev/ui/dropdown-menu", () => ({ DropdownMenu: ({ children }: { children: React.ReactNode }) =>
{children}
, DropdownMenuContent: ({ children }: { children: React.ReactNode }) =>
{children}
, DropdownMenuTrigger: ({ children }: { children: React.ReactNode }) => <>{children}, })); vi.mock("@kandev/ui/tooltip", () => ({ Tooltip: ({ children }: { children: React.ReactNode }) =>
{children}
, TooltipContent: ({ children }: { children: React.ReactNode }) =>
{children}
, TooltipTrigger: ({ children }: { children: React.ReactNode }) => <>{children}, })); vi.mock("./changes-panel-per-repo-menu", () => ({ PerRepoPullMenu: () => null, })); afterEach(cleanup); describe("PullDropdown remote safety", () => { it("keeps the history-change reason reachable while Pull is disabled", () => { render( , ); const pullButton = screen.getByRole("button", { name: /Pull/ }); expect(pullButton).toHaveProperty("disabled", true); expect(pullButton.parentElement?.getAttribute("tabindex")).toBe("0"); expect( screen.getByText( "Push, force-push, and Pull are disabled until the histories are reconciled.", ), ).toBeTruthy(); }); });