Skip to content

Commit e84ec93

Browse files
authored
test(pty): cover add-note keyboard actions (#336)
1 parent 35bb994 commit e84ec93

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

test/pty/ui-integration.test.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,47 @@ describe("live UI integration", () => {
578578
}
579579
});
580580

581+
test("clicked add-note drafts can cancel and save with keyboard shortcuts", async () => {
582+
const fixture = harness.createLongWrapFilePair();
583+
const session = await harness.launchHunk({
584+
args: ["diff", fixture.before, fixture.after, "--mode", "split"],
585+
cols: 120,
586+
rows: 20,
587+
});
588+
589+
try {
590+
await session.waitForText(/View\s+Navigate\s+Theme\s+Agent\s+Help/, {
591+
timeout: 15_000,
592+
});
593+
594+
await moveMouse(session, 8, 5);
595+
await session.waitForText(/\[\+\]/, { timeout: 5_000 });
596+
await session.click(/\[\+\]/);
597+
await session.waitForText(/Draft note/, { timeout: 5_000 });
598+
await session.type("Cancel this shortcut draft.");
599+
await session.press("escape");
600+
const cancelled = await harness.waitForSnapshot(
601+
session,
602+
(text) => !text.includes("Draft note") && !text.includes("Cancel this shortcut draft."),
603+
5_000,
604+
);
605+
606+
expect(cancelled).not.toContain("Your note");
607+
608+
await moveMouse(session, 8, 5);
609+
await session.waitForText(/\[\+\]/, { timeout: 5_000 });
610+
await session.click(/\[\+\]/);
611+
await session.waitForText(/Draft note/, { timeout: 5_000 });
612+
await session.type("Save this shortcut draft.");
613+
await session.press(["ctrl", "s"]);
614+
const saved = await session.waitForText(/Your note/, { timeout: 5_000 });
615+
616+
expect(saved).toContain("Save this shortcut draft.");
617+
} finally {
618+
session.close();
619+
}
620+
});
621+
581622
test("clicking diff add-note affordances can cancel and save draft notes", async () => {
582623
const fixture = harness.createLongWrapFilePair();
583624
const session = await harness.launchHunk({

0 commit comments

Comments
 (0)