diff options
| author | Billy Biggs <[email protected]> | 2025-07-14 05:34:20 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-14 03:34:20 +0000 |
| commit | ef8ec984894408953cc6e0ea2e46cfeb9c272507 (patch) | |
| tree | 06f956ae99b9ecb497e0fd717ac33ddf6cb0431a /packages/cli/src/ui/components/InputPrompt.test.tsx | |
| parent | b018e2d3ad1035d892fe769128e3bf8b3045eddb (diff) | |
Add back support for escaping newline with a \ character (#4064)
Diffstat (limited to 'packages/cli/src/ui/components/InputPrompt.test.tsx')
| -rw-r--r-- | packages/cli/src/ui/components/InputPrompt.test.tsx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/packages/cli/src/ui/components/InputPrompt.test.tsx b/packages/cli/src/ui/components/InputPrompt.test.tsx index ad7a3985..53a2cb0e 100644 --- a/packages/cli/src/ui/components/InputPrompt.test.tsx +++ b/packages/cli/src/ui/components/InputPrompt.test.tsx @@ -90,6 +90,7 @@ describe('InputPrompt', () => { killLineLeft: vi.fn(), openInExternalEditor: vi.fn(), newline: vi.fn(), + backspace: vi.fn(), } as unknown as TextBuffer; mockShellHistory = { @@ -527,4 +528,19 @@ describe('InputPrompt', () => { expect(props.onSubmit).not.toHaveBeenCalled(); unmount(); }); + + it('should add a newline on enter when the line ends with a backslash', async () => { + props.buffer.setText('first line\\'); + + const { stdin, unmount } = render(<InputPrompt {...props} />); + await wait(); + + stdin.write('\r'); + await wait(); + + expect(props.onSubmit).not.toHaveBeenCalled(); + expect(props.buffer.backspace).toHaveBeenCalled(); + expect(props.buffer.newline).toHaveBeenCalled(); + unmount(); + }); }); |
