дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-03 16:51:16 +02:00
The Shelf tab now lists each shelf's files beneath it in one tree instead of a separate files pane. View Options groups the files by Directory or Module and toggles Show Diff Preview (a side-by-side diff of the selected file, hidden in non-modal commit mode); Expand All / Collapse All work on the groups. File paths show inline, Delete and Cmd+Backspace delete the selected shelf or file, and the Shelve button, already in Local Changes, is gone from this toolbar. Co-authored-by: solhovoy <[email protected]>
89 рядки
4.2 KiB
TypeScript
89 рядки
4.2 KiB
TypeScript
import { expect, stubDesktop, test } from "./fixtures";
|
|
|
|
test("Shelf keeps patch and file selection available in a narrow dock", async ({ workbench: page }) => {
|
|
const name = "Reconcile payment and settlement totals before exporting ledger reports";
|
|
const directory = "services/settlement/internal/payment-reconciliation/statement-generation";
|
|
const filename = "invoiceSettlementRowAssembler.ts";
|
|
const file = directory + "/" + filename;
|
|
await page.setViewportSize({ width: 1440, height: 760 });
|
|
await stubDesktop(page);
|
|
await page.evaluate(
|
|
async ({ name, file }) => {
|
|
const root = "/dev/acme-api";
|
|
const h = window.__ipc.handlers;
|
|
h.vcs_roots = () => [{ root, operation: null, head: "main", headCommit: "1111111" }];
|
|
h.vcs_branch_info = () => ({
|
|
head: "main",
|
|
headCommit: "1111111",
|
|
upstream: null,
|
|
ahead: 0,
|
|
behind: 0,
|
|
operation: null,
|
|
});
|
|
h.vcs_status = () => [];
|
|
h.vcs_shelves = () => [
|
|
{
|
|
id: "settlement",
|
|
name,
|
|
timeMs: null,
|
|
branch: "main",
|
|
files: [file, "README.md"].map((path) => ({ path, kind: "modified", oldPath: null })),
|
|
},
|
|
{
|
|
id: "docs",
|
|
name: "Update release notes",
|
|
timeMs: null,
|
|
branch: "main",
|
|
files: [{ path: "CHANGELOG.md", kind: "modified", oldPath: null }],
|
|
},
|
|
];
|
|
h.vcs_shelf_diff = () => [];
|
|
const vcs = "/src/features/vcs/store.ts";
|
|
const { useVcs } = await import(/* @vite-ignore */ vcs);
|
|
useVcs.setState({ root, repo: root, roots: [root], available: true });
|
|
const project = "/src/platform/project.ts";
|
|
const { useProject } = await import(/* @vite-ignore */ project);
|
|
const settings = useProject.getState().settings ?? {};
|
|
useProject.setState({ settings: { ...settings, vcs: { ...settings.vcs, commit: { nonModal: true } } } });
|
|
const context = "/src/platform/context.ts";
|
|
(await import(/* @vite-ignore */ context)).setContext("vcsAvailable", true);
|
|
const dock = "/src/workbench/toolwindows/store.ts";
|
|
(await import(/* @vite-ignore */ dock)).setToolWindowSize("left", 228);
|
|
const actions = "/src/platform/actions.ts";
|
|
await (await import(/* @vite-ignore */ actions)).executeAction("vcs.showShelf");
|
|
},
|
|
{ name, file },
|
|
);
|
|
|
|
const panel = page.locator("[data-shelf-panel]");
|
|
const patches = panel.getByRole("tree", { name: "Shelved changes" });
|
|
const patch = patches.getByRole("treeitem").filter({ hasText: name });
|
|
await patch.click({ position: { x: 90, y: 12 } });
|
|
if ((await patch.getAttribute("aria-expanded")) === "false") await page.keyboard.press("ArrowRight");
|
|
const location = panel.getByText(directory, { exact: true });
|
|
await expect.poll(() => location.evaluate((el) => el.clientWidth)).toBeGreaterThan(100);
|
|
|
|
const files = patches;
|
|
await expect(patches.getByRole("treeitem").filter({ hasText: filename })).toHaveCount(1);
|
|
const row = files.getByRole("treeitem").filter({ hasText: filename });
|
|
const nameBox = (await row.getByText(filename, { exact: true }).boundingBox())!;
|
|
const pathBox = (await location.boundingBox())!;
|
|
expect(pathBox.x).toBeGreaterThan(nameBox.x + nameBox.width);
|
|
expect(Math.abs(pathBox.y + pathBox.height - nameBox.y - nameBox.height)).toBeLessThan(3);
|
|
await row.click({ position: { x: 90, y: 12 } });
|
|
await expect(row).toHaveAttribute("aria-selected", "true");
|
|
await panel.getByRole("button", { name: "Unshelve…", exact: true }).click();
|
|
const dialog = page.getByRole("dialog", { name: "Unshelve Changes" });
|
|
await expect(
|
|
dialog.getByRole("tree", { name: "Files to unshelve" }).getByText(filename, { exact: true }),
|
|
).toBeVisible();
|
|
await expect(dialog.getByText("README.md", { exact: true })).toHaveCount(0);
|
|
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
|
|
|
|
await expect(row).toHaveAttribute("aria-selected", "true");
|
|
const other = patches.getByRole("treeitem").filter({ hasText: "Update release notes" });
|
|
await other.click();
|
|
if ((await other.getAttribute("aria-expanded")) === "false") await page.keyboard.press("ArrowRight");
|
|
await expect(files.getByText("CHANGELOG.md", { exact: true })).toBeVisible();
|
|
});
|