/** * @file LaneChangesPanel.test.tsx * @description Pins the Changes panel's five modes and its three ranges: the * overview lists files and nothing else, clicking one opens that file's diff * (and asks the server for THAT path), Review asks for every file's hunks at * once, the range toggle changes which comparison is requested, History opens * one commit, and Files quick-opens a whole file. Also pins the per-file git * writes — including discard needing two clicks before the server hears * `confirm` — the JetBrains commit (ticked files, Changes ticked and * Unversioned Files not by default, Commit and Push, Add to VCS / .gitignore, * a change block's own checkbox making a hunk-level commit), a file's * history, Annotate, next/previous file, and the degrade for a cwd git * cannot read. * @author Nguyễn Ngọc Trí Vĩ */ import { describe, it, expect, vi, beforeEach } from "vitest"; import { render, screen, waitFor, act, within } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { LaneChangesPanel, gitChangeFor } from "../LaneChangesPanel"; import { confirmDialog, confirmDiscard } from "../../../lib/confirm"; import { api } from "../../../lib/api"; import type { LaneChanges } from "../../../lib/types"; // The themed confirm needs its host (App); answer it here. // CodeMirror does not run in jsdom: the editor is a textarea over the same props. vi.mock("../DiffEditor", () => ({ default: (p: { value: string; original: string; layout?: string; collapse?: boolean; label: string; onChange: (v: string) => void; onSave: () => void; }) => (