From 47a01441f5d7084df5ec4a9588da8e09167f93ee Mon Sep 17 00:00:00 2001 From: Ben Vinegar <2153+benvinegar@users.noreply.github.com> Date: Tue, 19 May 2026 23:39:34 -0400 Subject: [PATCH] test(pty): cover add-note keyboard actions --- test/pty/ui-integration.test.ts | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/test/pty/ui-integration.test.ts b/test/pty/ui-integration.test.ts index 839f455c..be59bf71 100644 --- a/test/pty/ui-integration.test.ts +++ b/test/pty/ui-integration.test.ts @@ -578,6 +578,47 @@ describe("live UI integration", () => { } }); + test("clicked add-note drafts can cancel and save with keyboard shortcuts", async () => { + const fixture = harness.createLongWrapFilePair(); + const session = await harness.launchHunk({ + args: ["diff", fixture.before, fixture.after, "--mode", "split"], + cols: 120, + rows: 20, + }); + + try { + await session.waitForText(/View\s+Navigate\s+Theme\s+Agent\s+Help/, { + timeout: 15_000, + }); + + await moveMouse(session, 8, 5); + await session.waitForText(/\[\+\]/, { timeout: 5_000 }); + await session.click(/\[\+\]/); + await session.waitForText(/Draft note/, { timeout: 5_000 }); + await session.type("Cancel this shortcut draft."); + await session.press("escape"); + const cancelled = await harness.waitForSnapshot( + session, + (text) => !text.includes("Draft note") && !text.includes("Cancel this shortcut draft."), + 5_000, + ); + + expect(cancelled).not.toContain("Your note"); + + await moveMouse(session, 8, 5); + await session.waitForText(/\[\+\]/, { timeout: 5_000 }); + await session.click(/\[\+\]/); + await session.waitForText(/Draft note/, { timeout: 5_000 }); + await session.type("Save this shortcut draft."); + await session.press(["ctrl", "s"]); + const saved = await session.waitForText(/Your note/, { timeout: 5_000 }); + + expect(saved).toContain("Save this shortcut draft."); + } finally { + session.close(); + } + }); + test("clicking diff add-note affordances can cancel and save draft notes", async () => { const fixture = harness.createLongWrapFilePair(); const session = await harness.launchHunk({