diff options
| author | Deepankar Sharma <[email protected]> | 2025-08-13 13:32:54 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-13 17:32:54 +0000 |
| commit | 9c7fb870c1a7c80741fafdfc6837d4b92e373b2d (patch) | |
| tree | 1e31f201520c9724b4659ee7a36c21215e6280b9 /packages/cli/src/ui/hooks/useKeypress.test.ts | |
| parent | 74a13fb535b255797d6c9aa3499acfea6aadc58d (diff) | |
Add terminal setup command for Shift+Enter and Ctrl+Enter support (#3289)
Co-authored-by: jacob314 <[email protected]>
Diffstat (limited to 'packages/cli/src/ui/hooks/useKeypress.test.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/useKeypress.test.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/packages/cli/src/ui/hooks/useKeypress.test.ts b/packages/cli/src/ui/hooks/useKeypress.test.ts index a30eabf2..946ee054 100644 --- a/packages/cli/src/ui/hooks/useKeypress.test.ts +++ b/packages/cli/src/ui/hooks/useKeypress.test.ts @@ -134,9 +134,14 @@ describe('useKeypress', () => { expect(onKeypress).not.toHaveBeenCalled(); }); - it('should listen for keypress when active', () => { + it.each([ + { key: { name: 'a', sequence: 'a' } }, + { key: { name: 'left', sequence: '\x1b[D' } }, + { key: { name: 'right', sequence: '\x1b[C' } }, + { key: { name: 'up', sequence: '\x1b[A' } }, + { key: { name: 'down', sequence: '\x1b[B' } }, + ])('should listen for keypress when active for key $key.name', ({ key }) => { renderHook(() => useKeypress(onKeypress, { isActive: true })); - const key = { name: 'a', sequence: 'a' }; act(() => stdin.pressKey(key)); expect(onKeypress).toHaveBeenCalledWith(expect.objectContaining(key)); }); @@ -187,7 +192,7 @@ describe('useKeypress', () => { }, isLegacy: true, }, - ])('Paste Handling in $description', ({ setup, isLegacy }) => { + ])('in $description', ({ setup, isLegacy }) => { beforeEach(() => { setup(); stdin.setLegacy(isLegacy); |
