mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-14 16:07:52 +00:00
Pressing Cmd+Down or F4 in a focused revision diff did nothing when the working file was found after focus entered the pane: the keyboard dispatcher kept the navigator object registered before that lookup, while the diff replaced it. The diff now keeps the registered navigator and refreshes its handlers in place, so Jump to Source opens the working file at the mapped caret. Co-authored-by: shohruh-genius <7658451+shohruh-genius@users.noreply.github.com>
40 lines
1.7 KiB
TypeScript
40 lines
1.7 KiB
TypeScript
import { expect, stubDesktop, test } from "./fixtures";
|
|
|
|
test.use({ video: "on" });
|
|
|
|
test("opens the working file with Command+Down after a revision diff loads its source", async ({ workbench: page }) => {
|
|
await stubDesktop(page);
|
|
await page.evaluate(async () => {
|
|
const path = "/dev/acme-api/README.md";
|
|
const probe = new Promise((resolve) => {
|
|
window.__ipc.handlers.complete_probe = () => resolve({ size: 48, binary: false, tooLarge: false });
|
|
});
|
|
window.__ipc.handlers.fs_probe = ({ path: candidate }) => (candidate === path ? probe : null);
|
|
window.__ipc.handlers.fs_read_text = () => "# Acme API\n\nWorking copy\n";
|
|
const keymap = "/src/platform/keymap.ts";
|
|
(await import(/* @vite-ignore */ keymap)).applyKeymapSettings("intellij-macos", {});
|
|
const actions = "/src/platform/actions.ts";
|
|
await (
|
|
await import(/* @vite-ignore */ actions)
|
|
).executeAction("diff.compareTexts", {
|
|
path,
|
|
left: { text: "# Acme API\n\nPrevious commit\n", label: "Parent" },
|
|
right: { text: "# Acme API\n\nNew commit\n", label: "Commit" },
|
|
});
|
|
});
|
|
|
|
const pane = page.locator(".cm-merge-b .cm-content");
|
|
await pane.click();
|
|
await expect(pane).toBeFocused();
|
|
const jump = page.getByRole("button", { name: "Jump to Source", exact: true });
|
|
await expect(jump).toHaveCount(0);
|
|
await page.evaluate(() => window.__ipc.handlers.complete_probe!({}));
|
|
await expect(jump).toBeVisible();
|
|
await expect(pane).toBeFocused();
|
|
|
|
await page.keyboard.press("Meta+ArrowDown");
|
|
await page.screenshot({ path: test.info().outputPath("jump-to-source.png"), animations: "disabled" });
|
|
await expect(page.getByRole("tab", { name: "README.md", exact: true, selected: true })).toBeVisible();
|
|
await expect(pane).toBeHidden();
|
|
});
|