mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
chore: renable test (#11582)
This commit is contained in:
@@ -1950,22 +1950,51 @@ describe('InputPrompt', () => {
|
|||||||
unmount();
|
unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('text and cursor position should be restored after reverse search', async () => {
|
it('should restore text and cursor position after reverse search"', async () => {
|
||||||
props.buffer.setText('initial text');
|
const initialText = 'initial text';
|
||||||
props.buffer.cursor = [0, 3];
|
const initialCursor: [number, number] = [0, 3];
|
||||||
|
|
||||||
|
props.buffer.setText(initialText);
|
||||||
|
props.buffer.cursor = initialCursor;
|
||||||
|
|
||||||
|
// Mock the reverse search completion to be active and then reset
|
||||||
|
const mockResetCompletionState = vi.fn();
|
||||||
|
mockedUseReverseSearchCompletion.mockImplementation(
|
||||||
|
(buffer, shellHistory, reverseSearchActiveFromInputPrompt) => ({
|
||||||
|
...mockReverseSearchCompletion,
|
||||||
|
suggestions: reverseSearchActiveFromInputPrompt
|
||||||
|
? [{ label: 'history item', value: 'history item' }]
|
||||||
|
: [],
|
||||||
|
showSuggestions: reverseSearchActiveFromInputPrompt,
|
||||||
|
resetCompletionState: mockResetCompletionState,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
const { stdin, stdout, unmount } = renderWithProviders(
|
const { stdin, stdout, unmount } = renderWithProviders(
|
||||||
<InputPrompt {...props} />,
|
<InputPrompt {...props} />,
|
||||||
);
|
);
|
||||||
stdin.write('\x12');
|
|
||||||
await wait();
|
await wait();
|
||||||
|
|
||||||
|
// reverse search with Ctrl+R
|
||||||
|
act(() => {
|
||||||
|
stdin.write('\x12');
|
||||||
|
});
|
||||||
|
await wait();
|
||||||
|
|
||||||
expect(stdout.lastFrame()).toContain('(r:)');
|
expect(stdout.lastFrame()).toContain('(r:)');
|
||||||
stdin.write('\u001b[27u'); // Press kitty escape key
|
|
||||||
|
// Press kitty escape key
|
||||||
|
act(() => {
|
||||||
|
stdin.write('\u001b[27u');
|
||||||
|
});
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(stdout.lastFrame()).not.toContain('(r:)');
|
expect(stdout.lastFrame()).not.toContain('(r:)');
|
||||||
|
expect(mockResetCompletionState).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
expect(props.buffer.text).toBe('initial text');
|
|
||||||
expect(props.buffer.cursor).toEqual([0, 3]);
|
expect(props.buffer.text).toBe(initialText);
|
||||||
|
expect(props.buffer.cursor).toEqual(initialCursor);
|
||||||
|
|
||||||
unmount();
|
unmount();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user