@google/gemini-cli 0.12.0-preview.4 → 0.13.0-nightly.20251031.c89bc30d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/google-gemini-cli-0.13.0-nightly.20251029.cca41edc.tgz +0 -0
- package/dist/package.json +2 -2
- package/dist/src/commands/extensions/install.js +2 -2
- package/dist/src/commands/extensions/install.js.map +1 -1
- package/dist/src/commands/extensions/install.test.js +27 -16
- package/dist/src/commands/extensions/install.test.js.map +1 -1
- package/dist/src/commands/extensions/link.js +2 -2
- package/dist/src/commands/extensions/link.js.map +1 -1
- package/dist/src/commands/extensions/update.js +3 -2
- package/dist/src/commands/extensions/update.js.map +1 -1
- package/dist/src/commands/extensions/validate.d.ts +12 -0
- package/dist/src/commands/extensions/validate.js +83 -0
- package/dist/src/commands/extensions/validate.js.map +1 -0
- package/dist/src/commands/extensions/validate.test.d.ts +6 -0
- package/dist/src/commands/extensions/validate.test.js +93 -0
- package/dist/src/commands/extensions/validate.test.js.map +1 -0
- package/dist/src/commands/extensions.js +2 -0
- package/dist/src/commands/extensions.js.map +1 -1
- package/dist/src/config/auth.js +0 -5
- package/dist/src/config/auth.js.map +1 -1
- package/dist/src/config/auth.test.js +1 -3
- package/dist/src/config/auth.test.js.map +1 -1
- package/dist/src/config/config.js +2 -1
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +6 -10
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/extensions/update.d.ts +2 -2
- package/dist/src/config/extensions/update.js +28 -22
- package/dist/src/config/extensions/update.js.map +1 -1
- package/dist/src/config/sandboxConfig.d.ts +1 -1
- package/dist/src/config/sandboxConfig.js +6 -3
- package/dist/src/config/sandboxConfig.js.map +1 -1
- package/dist/src/config/settings.js +2 -2
- package/dist/src/config/settings.js.map +1 -1
- package/dist/src/config/settings.test.js +13 -53
- package/dist/src/config/settings.test.js.map +1 -1
- package/dist/src/config/settingsSchema.d.ts +25 -7
- package/dist/src/config/settingsSchema.js +24 -6
- package/dist/src/config/settingsSchema.js.map +1 -1
- package/dist/src/config/settingsSchema.test.js +2 -0
- package/dist/src/config/settingsSchema.test.js.map +1 -1
- package/dist/src/gemini.js +8 -1
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/gemini.test.js +1 -0
- package/dist/src/gemini.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/generated/git-commit.js.map +1 -1
- package/dist/src/nonInteractiveCli.d.ts +9 -1
- package/dist/src/nonInteractiveCli.js +16 -1
- package/dist/src/nonInteractiveCli.js.map +1 -1
- package/dist/src/nonInteractiveCli.test.js +209 -103
- package/dist/src/nonInteractiveCli.test.js.map +1 -1
- package/dist/src/test-utils/async.d.ts +9 -0
- package/dist/src/test-utils/async.js +29 -0
- package/dist/src/test-utils/async.js.map +1 -0
- package/dist/src/test-utils/render.d.ts +2 -1
- package/dist/src/test-utils/render.js +23 -1
- package/dist/src/test-utils/render.js.map +1 -1
- package/dist/src/test-utils/render.test.js +29 -4
- package/dist/src/test-utils/render.test.js.map +1 -1
- package/dist/src/ui/App.test.js +1 -1
- package/dist/src/ui/App.test.js.map +1 -1
- package/dist/src/ui/AppContainer.js +33 -4
- package/dist/src/ui/AppContainer.js.map +1 -1
- package/dist/src/ui/AppContainer.test.js +205 -99
- package/dist/src/ui/AppContainer.test.js.map +1 -1
- package/dist/src/ui/auth/ApiAuthDialog.d.ts +14 -0
- package/dist/src/ui/auth/ApiAuthDialog.js +26 -0
- package/dist/src/ui/auth/ApiAuthDialog.js.map +1 -0
- package/dist/src/ui/auth/ApiAuthDialog.test.d.ts +6 -0
- package/dist/src/ui/auth/ApiAuthDialog.test.js +91 -0
- package/dist/src/ui/auth/ApiAuthDialog.test.js.map +1 -0
- package/dist/src/ui/auth/AuthDialog.js +7 -3
- package/dist/src/ui/auth/AuthDialog.js.map +1 -1
- package/dist/src/ui/auth/AuthDialog.test.js +1 -1
- package/dist/src/ui/auth/AuthDialog.test.js.map +1 -1
- package/dist/src/ui/auth/useAuth.d.ts +2 -0
- package/dist/src/ui/auth/useAuth.js +31 -2
- package/dist/src/ui/auth/useAuth.js.map +1 -1
- package/dist/src/ui/components/AnsiOutput.test.js +1 -1
- package/dist/src/ui/components/AnsiOutput.test.js.map +1 -1
- package/dist/src/ui/components/Composer.test.js +1 -1
- package/dist/src/ui/components/Composer.test.js.map +1 -1
- package/dist/src/ui/components/ConsentPrompt.test.js +18 -8
- package/dist/src/ui/components/ConsentPrompt.test.js.map +1 -1
- package/dist/src/ui/components/ContextSummaryDisplay.test.js +11 -6
- package/dist/src/ui/components/ContextSummaryDisplay.test.js.map +1 -1
- package/dist/src/ui/components/DialogManager.js +4 -0
- package/dist/src/ui/components/DialogManager.js.map +1 -1
- package/dist/src/ui/components/FolderTrustDialog.test.js +4 -3
- package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -1
- package/dist/src/ui/components/Footer.js +3 -2
- package/dist/src/ui/components/Footer.js.map +1 -1
- package/dist/src/ui/components/Footer.test.js +59 -0
- package/dist/src/ui/components/Footer.test.js.map +1 -1
- package/dist/src/ui/components/Header.test.js +9 -5
- package/dist/src/ui/components/Header.test.js.map +1 -1
- package/dist/src/ui/components/Help.test.js +5 -3
- package/dist/src/ui/components/Help.test.js.map +1 -1
- package/dist/src/ui/components/InputPrompt.test.js +139 -111
- package/dist/src/ui/components/InputPrompt.test.js.map +1 -1
- package/dist/src/ui/components/LoadingIndicator.test.js +27 -14
- package/dist/src/ui/components/LoadingIndicator.test.js.map +1 -1
- package/dist/src/ui/components/ModelDialog.test.js +20 -10
- package/dist/src/ui/components/ModelDialog.test.js.map +1 -1
- package/dist/src/ui/components/ModelStatsDisplay.test.js +1 -1
- package/dist/src/ui/components/ModelStatsDisplay.test.js.map +1 -1
- package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js +11 -10
- package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js.map +1 -1
- package/dist/src/ui/components/PrepareLabel.test.js +13 -7
- package/dist/src/ui/components/PrepareLabel.test.js.map +1 -1
- package/dist/src/ui/components/ProQuotaDialog.test.js +14 -6
- package/dist/src/ui/components/ProQuotaDialog.test.js.map +1 -1
- package/dist/src/ui/components/QueuedMessageDisplay.test.js +11 -6
- package/dist/src/ui/components/QueuedMessageDisplay.test.js.map +1 -1
- package/dist/src/ui/components/SessionSummaryDisplay.test.js +1 -1
- package/dist/src/ui/components/SessionSummaryDisplay.test.js.map +1 -1
- package/dist/src/ui/components/SettingsDialog.test.js +438 -512
- package/dist/src/ui/components/SettingsDialog.test.js.map +1 -1
- package/dist/src/ui/components/StatsDisplay.test.js +1 -1
- package/dist/src/ui/components/StatsDisplay.test.js.map +1 -1
- package/dist/src/ui/components/ThemeDialog.test.js +3 -2
- package/dist/src/ui/components/ThemeDialog.test.js.map +1 -1
- package/dist/src/ui/components/ToolStatsDisplay.test.js +1 -1
- package/dist/src/ui/components/ToolStatsDisplay.test.js.map +1 -1
- package/dist/src/ui/components/messages/CompressionMessage.test.js +25 -17
- package/dist/src/ui/components/messages/CompressionMessage.test.js.map +1 -1
- package/dist/src/ui/components/messages/DiffRenderer.test.js +1 -1
- package/dist/src/ui/components/messages/DiffRenderer.test.js.map +1 -1
- package/dist/src/ui/components/messages/Todo.js +27 -5
- package/dist/src/ui/components/messages/Todo.js.map +1 -1
- package/dist/src/ui/components/messages/Todo.test.js +20 -8
- package/dist/src/ui/components/messages/Todo.test.js.map +1 -1
- package/dist/src/ui/components/messages/ToolGroupMessage.test.js +29 -15
- package/dist/src/ui/components/messages/ToolGroupMessage.test.js.map +1 -1
- package/dist/src/ui/components/shared/BaseSelectionList.test.js +12 -11
- package/dist/src/ui/components/shared/BaseSelectionList.test.js.map +1 -1
- package/dist/src/ui/components/shared/MaxSizedBox.test.js +43 -22
- package/dist/src/ui/components/shared/MaxSizedBox.test.js.map +1 -1
- package/dist/src/ui/components/shared/TextInput.d.ts +15 -0
- package/dist/src/ui/components/shared/TextInput.js +38 -0
- package/dist/src/ui/components/shared/TextInput.js.map +1 -0
- package/dist/src/ui/components/shared/TextInput.test.d.ts +6 -0
- package/dist/src/ui/components/shared/TextInput.test.js +242 -0
- package/dist/src/ui/components/shared/TextInput.test.js.map +1 -0
- package/dist/src/ui/components/shared/text-buffer.d.ts +8 -2
- package/dist/src/ui/components/shared/text-buffer.js +28 -13
- package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
- package/dist/src/ui/components/shared/text-buffer.test.js +137 -0
- package/dist/src/ui/components/shared/text-buffer.test.js.map +1 -1
- package/dist/src/ui/components/views/ChatList.test.js +7 -4
- package/dist/src/ui/components/views/ChatList.test.js.map +1 -1
- package/dist/src/ui/components/views/ExtensionsList.js +1 -0
- package/dist/src/ui/components/views/ExtensionsList.js.map +1 -1
- package/dist/src/ui/components/views/ExtensionsList.test.js +13 -5
- package/dist/src/ui/components/views/ExtensionsList.test.js.map +1 -1
- package/dist/src/ui/components/views/McpStatus.test.js +23 -12
- package/dist/src/ui/components/views/McpStatus.test.js.map +1 -1
- package/dist/src/ui/contexts/KeypressContext.test.js +132 -252
- package/dist/src/ui/contexts/KeypressContext.test.js.map +1 -1
- package/dist/src/ui/contexts/SessionContext.test.js +9 -5
- package/dist/src/ui/contexts/SessionContext.test.js.map +1 -1
- package/dist/src/ui/contexts/UIActionsContext.d.ts +2 -0
- package/dist/src/ui/contexts/UIActionsContext.js.map +1 -1
- package/dist/src/ui/contexts/UIStateContext.d.ts +2 -0
- package/dist/src/ui/contexts/UIStateContext.js.map +1 -1
- package/dist/src/ui/hooks/atCommandProcessor.js +29 -7
- package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/atCommandProcessor.test.js +163 -64
- package/dist/src/ui/hooks/atCommandProcessor.test.js.map +1 -1
- package/dist/src/ui/hooks/shellCommandProcessor.test.js +47 -34
- package/dist/src/ui/hooks/shellCommandProcessor.test.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.test.js +141 -104
- package/dist/src/ui/hooks/slashCommandProcessor.test.js.map +1 -1
- package/dist/src/ui/hooks/useAtCompletion.test.js +23 -21
- package/dist/src/ui/hooks/useAtCompletion.test.js.map +1 -1
- package/dist/src/ui/hooks/useCommandCompletion.test.js +16 -15
- package/dist/src/ui/hooks/useCommandCompletion.test.js.map +1 -1
- package/dist/src/ui/hooks/useConsoleMessages.test.js +1 -1
- package/dist/src/ui/hooks/useConsoleMessages.test.js.map +1 -1
- package/dist/src/ui/hooks/useEditorSettings.test.js +1 -1
- package/dist/src/ui/hooks/useEditorSettings.test.js.map +1 -1
- package/dist/src/ui/hooks/useExtensionUpdates.d.ts +1 -1
- package/dist/src/ui/hooks/useExtensionUpdates.js +9 -3
- package/dist/src/ui/hooks/useExtensionUpdates.js.map +1 -1
- package/dist/src/ui/hooks/useExtensionUpdates.test.js +10 -9
- package/dist/src/ui/hooks/useExtensionUpdates.test.js.map +1 -1
- package/dist/src/ui/hooks/useFocus.test.js +1 -1
- package/dist/src/ui/hooks/useFocus.test.js.map +1 -1
- package/dist/src/ui/hooks/useFolderTrust.test.js +7 -6
- package/dist/src/ui/hooks/useFolderTrust.test.js.map +1 -1
- package/dist/src/ui/hooks/useGeminiStream.test.js +39 -38
- package/dist/src/ui/hooks/useGeminiStream.test.js.map +1 -1
- package/dist/src/ui/hooks/useGitBranchName.test.js +5 -4
- package/dist/src/ui/hooks/useGitBranchName.test.js.map +1 -1
- package/dist/src/ui/hooks/useIdeTrustListener.test.js +25 -11
- package/dist/src/ui/hooks/useIdeTrustListener.test.js.map +1 -1
- package/dist/src/ui/hooks/useKeypress.test.js +1 -1
- package/dist/src/ui/hooks/useKeypress.test.js.map +1 -1
- package/dist/src/ui/hooks/useLoadingIndicator.test.js +1 -1
- package/dist/src/ui/hooks/useLoadingIndicator.test.js.map +1 -1
- package/dist/src/ui/hooks/useMemoryMonitor.test.js +1 -1
- package/dist/src/ui/hooks/useMemoryMonitor.test.js.map +1 -1
- package/dist/src/ui/hooks/useMessageQueue.test.js +5 -4
- package/dist/src/ui/hooks/useMessageQueue.test.js.map +1 -1
- package/dist/src/ui/hooks/useModelCommand.test.js +7 -4
- package/dist/src/ui/hooks/useModelCommand.test.js.map +1 -1
- package/dist/src/ui/hooks/usePhraseCycler.test.js +46 -16
- package/dist/src/ui/hooks/usePhraseCycler.test.js.map +1 -1
- package/dist/src/ui/hooks/usePrivacySettings.test.js +11 -7
- package/dist/src/ui/hooks/usePrivacySettings.test.js.map +1 -1
- package/dist/src/ui/hooks/useQuotaAndFallback.test.js +28 -14
- package/dist/src/ui/hooks/useQuotaAndFallback.test.js.map +1 -1
- package/dist/src/ui/hooks/useSelectionList.test.js +116 -109
- package/dist/src/ui/hooks/useSelectionList.test.js.map +1 -1
- package/dist/src/ui/hooks/useShellHistory.test.js +25 -17
- package/dist/src/ui/hooks/useShellHistory.test.js.map +1 -1
- package/dist/src/ui/hooks/useSlashCompletion.js +18 -7
- package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useSlashCompletion.test.js +244 -111
- package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -1
- package/dist/src/ui/hooks/useTimer.test.js +1 -1
- package/dist/src/ui/hooks/useTimer.test.js.map +1 -1
- package/dist/src/ui/hooks/useToolScheduler.test.js +6 -2
- package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
- package/dist/src/ui/hooks/vim.test.js +6 -21
- package/dist/src/ui/hooks/vim.test.js.map +1 -1
- package/dist/src/ui/state/extensions.d.ts +1 -0
- package/dist/src/ui/state/extensions.js +1 -0
- package/dist/src/ui/state/extensions.js.map +1 -1
- package/dist/src/ui/types.d.ts +1 -0
- package/dist/src/ui/types.js +2 -0
- package/dist/src/ui/types.js.map +1 -1
- package/dist/src/ui/utils/clipboardUtils.js +2 -2
- package/dist/src/ui/utils/clipboardUtils.js.map +1 -1
- package/dist/src/ui/utils/updateCheck.js +6 -3
- package/dist/src/ui/utils/updateCheck.js.map +1 -1
- package/dist/src/ui/utils/updateCheck.test.js +5 -1
- package/dist/src/ui/utils/updateCheck.test.js.map +1 -1
- package/dist/src/utils/commentJson.js +2 -2
- package/dist/src/utils/commentJson.js.map +1 -1
- package/dist/src/utils/commentJson.test.js +7 -6
- package/dist/src/utils/commentJson.test.js.map +1 -1
- package/dist/src/utils/version.js +6 -2
- package/dist/src/utils/version.js.map +1 -1
- package/dist/src/zed-integration/acp.js +2 -1
- package/dist/src/zed-integration/acp.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/google-gemini-cli-0.12.0-preview.3.tgz +0 -0
- package/dist/src/utils/package.d.ts +0 -12
- package/dist/src/utils/package.js +0 -24
- package/dist/src/utils/package.js.map +0 -1
|
@@ -5,6 +5,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
7
|
import { renderWithProviders } from '../../test-utils/render.js';
|
|
8
|
+
import { waitFor } from '../../test-utils/async.js';
|
|
8
9
|
import { act } from 'react';
|
|
9
10
|
import { InputPrompt } from './InputPrompt.js';
|
|
10
11
|
import { ApprovalMode } from '@google/gemini-cli-core';
|
|
@@ -213,7 +214,7 @@ describe('InputPrompt', () => {
|
|
|
213
214
|
await act(async () => {
|
|
214
215
|
stdin.write('\u001B[A');
|
|
215
216
|
});
|
|
216
|
-
await
|
|
217
|
+
await waitFor(() => expect(mockShellHistory.getPreviousCommand).toHaveBeenCalled());
|
|
217
218
|
unmount();
|
|
218
219
|
});
|
|
219
220
|
it('should call shellHistory.getNextCommand on down arrow in shell mode', async () => {
|
|
@@ -221,8 +222,8 @@ describe('InputPrompt', () => {
|
|
|
221
222
|
const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
|
|
222
223
|
await act(async () => {
|
|
223
224
|
stdin.write('\u001B[B');
|
|
225
|
+
await waitFor(() => expect(mockShellHistory.getNextCommand).toHaveBeenCalled());
|
|
224
226
|
});
|
|
225
|
-
await vi.waitFor(() => expect(mockShellHistory.getNextCommand).toHaveBeenCalled());
|
|
226
227
|
unmount();
|
|
227
228
|
});
|
|
228
229
|
it('should set the buffer text when a shell history command is retrieved', async () => {
|
|
@@ -232,7 +233,7 @@ describe('InputPrompt', () => {
|
|
|
232
233
|
await act(async () => {
|
|
233
234
|
stdin.write('\u001B[A');
|
|
234
235
|
});
|
|
235
|
-
await
|
|
236
|
+
await waitFor(() => {
|
|
236
237
|
expect(mockShellHistory.getPreviousCommand).toHaveBeenCalled();
|
|
237
238
|
expect(props.buffer.setText).toHaveBeenCalledWith('previous command');
|
|
238
239
|
});
|
|
@@ -245,7 +246,7 @@ describe('InputPrompt', () => {
|
|
|
245
246
|
await act(async () => {
|
|
246
247
|
stdin.write('\r');
|
|
247
248
|
});
|
|
248
|
-
await
|
|
249
|
+
await waitFor(() => {
|
|
249
250
|
expect(mockShellHistory.addCommandToHistory).toHaveBeenCalledWith('ls -l');
|
|
250
251
|
expect(props.onSubmit).toHaveBeenCalledWith('ls -l');
|
|
251
252
|
});
|
|
@@ -257,15 +258,15 @@ describe('InputPrompt', () => {
|
|
|
257
258
|
await act(async () => {
|
|
258
259
|
stdin.write('\u001B[A'); // Up arrow
|
|
259
260
|
});
|
|
260
|
-
await
|
|
261
|
+
await waitFor(() => expect(mockInputHistory.navigateUp).toHaveBeenCalled());
|
|
261
262
|
await act(async () => {
|
|
262
263
|
stdin.write('\u001B[B'); // Down arrow
|
|
263
264
|
});
|
|
264
|
-
await
|
|
265
|
+
await waitFor(() => expect(mockInputHistory.navigateDown).toHaveBeenCalled());
|
|
265
266
|
await act(async () => {
|
|
266
267
|
stdin.write('\r'); // Enter
|
|
267
268
|
});
|
|
268
|
-
await
|
|
269
|
+
await waitFor(() => expect(props.onSubmit).toHaveBeenCalledWith('some text'));
|
|
269
270
|
expect(mockShellHistory.getPreviousCommand).not.toHaveBeenCalled();
|
|
270
271
|
expect(mockShellHistory.getNextCommand).not.toHaveBeenCalled();
|
|
271
272
|
expect(mockShellHistory.addCommandToHistory).not.toHaveBeenCalled();
|
|
@@ -286,11 +287,11 @@ describe('InputPrompt', () => {
|
|
|
286
287
|
await act(async () => {
|
|
287
288
|
stdin.write('\u001B[A'); // Up arrow
|
|
288
289
|
});
|
|
289
|
-
await
|
|
290
|
+
await waitFor(() => expect(mockCommandCompletion.navigateUp).toHaveBeenCalledTimes(1));
|
|
290
291
|
await act(async () => {
|
|
291
292
|
stdin.write('\u0010'); // Ctrl+P
|
|
292
293
|
});
|
|
293
|
-
await
|
|
294
|
+
await waitFor(() => expect(mockCommandCompletion.navigateUp).toHaveBeenCalledTimes(2));
|
|
294
295
|
expect(mockCommandCompletion.navigateDown).not.toHaveBeenCalled();
|
|
295
296
|
unmount();
|
|
296
297
|
});
|
|
@@ -309,11 +310,11 @@ describe('InputPrompt', () => {
|
|
|
309
310
|
await act(async () => {
|
|
310
311
|
stdin.write('\u001B[B'); // Down arrow
|
|
311
312
|
});
|
|
312
|
-
await
|
|
313
|
+
await waitFor(() => expect(mockCommandCompletion.navigateDown).toHaveBeenCalledTimes(1));
|
|
313
314
|
await act(async () => {
|
|
314
315
|
stdin.write('\u000E'); // Ctrl+N
|
|
315
316
|
});
|
|
316
|
-
await
|
|
317
|
+
await waitFor(() => expect(mockCommandCompletion.navigateDown).toHaveBeenCalledTimes(2));
|
|
317
318
|
expect(mockCommandCompletion.navigateUp).not.toHaveBeenCalled();
|
|
318
319
|
unmount();
|
|
319
320
|
});
|
|
@@ -327,21 +328,21 @@ describe('InputPrompt', () => {
|
|
|
327
328
|
await act(async () => {
|
|
328
329
|
stdin.write('\u001B[A'); // Up arrow
|
|
329
330
|
});
|
|
330
|
-
await
|
|
331
|
+
await waitFor(() => expect(mockInputHistory.navigateUp).toHaveBeenCalled());
|
|
331
332
|
await act(async () => {
|
|
332
333
|
stdin.write('\u001B[B'); // Down arrow
|
|
333
334
|
});
|
|
334
|
-
await
|
|
335
|
+
await waitFor(() => expect(mockInputHistory.navigateDown).toHaveBeenCalled());
|
|
335
336
|
await act(async () => {
|
|
336
337
|
stdin.write('\u0010'); // Ctrl+P
|
|
337
338
|
});
|
|
338
|
-
await vi.waitFor(() => { });
|
|
339
339
|
await act(async () => {
|
|
340
340
|
stdin.write('\u000E'); // Ctrl+N
|
|
341
341
|
});
|
|
342
|
-
await
|
|
343
|
-
|
|
344
|
-
|
|
342
|
+
await waitFor(() => {
|
|
343
|
+
expect(mockCommandCompletion.navigateUp).not.toHaveBeenCalled();
|
|
344
|
+
expect(mockCommandCompletion.navigateDown).not.toHaveBeenCalled();
|
|
345
|
+
});
|
|
345
346
|
unmount();
|
|
346
347
|
});
|
|
347
348
|
describe('clipboard image paste', () => {
|
|
@@ -358,7 +359,7 @@ describe('InputPrompt', () => {
|
|
|
358
359
|
await act(async () => {
|
|
359
360
|
stdin.write('\x16'); // Ctrl+V
|
|
360
361
|
});
|
|
361
|
-
await
|
|
362
|
+
await waitFor(() => {
|
|
362
363
|
expect(clipboardUtils.clipboardHasImage).toHaveBeenCalled();
|
|
363
364
|
expect(clipboardUtils.saveClipboardImage).toHaveBeenCalledWith(props.config.getTargetDir());
|
|
364
365
|
expect(clipboardUtils.cleanupOldClipboardImages).toHaveBeenCalledWith(props.config.getTargetDir());
|
|
@@ -372,7 +373,7 @@ describe('InputPrompt', () => {
|
|
|
372
373
|
await act(async () => {
|
|
373
374
|
stdin.write('\x16'); // Ctrl+V
|
|
374
375
|
});
|
|
375
|
-
await
|
|
376
|
+
await waitFor(() => {
|
|
376
377
|
expect(clipboardUtils.clipboardHasImage).toHaveBeenCalled();
|
|
377
378
|
});
|
|
378
379
|
expect(clipboardUtils.saveClipboardImage).not.toHaveBeenCalled();
|
|
@@ -386,7 +387,7 @@ describe('InputPrompt', () => {
|
|
|
386
387
|
await act(async () => {
|
|
387
388
|
stdin.write('\x16'); // Ctrl+V
|
|
388
389
|
});
|
|
389
|
-
await
|
|
390
|
+
await waitFor(() => {
|
|
390
391
|
expect(clipboardUtils.saveClipboardImage).toHaveBeenCalled();
|
|
391
392
|
});
|
|
392
393
|
expect(mockBuffer.setText).not.toHaveBeenCalled();
|
|
@@ -405,7 +406,7 @@ describe('InputPrompt', () => {
|
|
|
405
406
|
await act(async () => {
|
|
406
407
|
stdin.write('\x16'); // Ctrl+V
|
|
407
408
|
});
|
|
408
|
-
await
|
|
409
|
+
await waitFor(() => {
|
|
409
410
|
// Should insert at cursor position with spaces
|
|
410
411
|
expect(mockBuffer.replaceRangeByOffset).toHaveBeenCalled();
|
|
411
412
|
});
|
|
@@ -426,7 +427,7 @@ describe('InputPrompt', () => {
|
|
|
426
427
|
await act(async () => {
|
|
427
428
|
stdin.write('\x16'); // Ctrl+V
|
|
428
429
|
});
|
|
429
|
-
await
|
|
430
|
+
await waitFor(() => {
|
|
430
431
|
expect(consoleErrorSpy).toHaveBeenCalledWith('Error handling clipboard image:', expect.any(Error));
|
|
431
432
|
});
|
|
432
433
|
expect(mockBuffer.setText).not.toHaveBeenCalled();
|
|
@@ -447,7 +448,7 @@ describe('InputPrompt', () => {
|
|
|
447
448
|
await act(async () => {
|
|
448
449
|
stdin.write('\t'); // Press Tab
|
|
449
450
|
});
|
|
450
|
-
await
|
|
451
|
+
await waitFor(() => expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(0));
|
|
451
452
|
unmount();
|
|
452
453
|
});
|
|
453
454
|
it('should append a sub-command when the parent command is already complete', async () => {
|
|
@@ -466,7 +467,7 @@ describe('InputPrompt', () => {
|
|
|
466
467
|
await act(async () => {
|
|
467
468
|
stdin.write('\t'); // Press Tab
|
|
468
469
|
});
|
|
469
|
-
await
|
|
470
|
+
await waitFor(() => expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(1));
|
|
470
471
|
unmount();
|
|
471
472
|
});
|
|
472
473
|
it('should handle the "backspace" edge case correctly', async () => {
|
|
@@ -486,7 +487,7 @@ describe('InputPrompt', () => {
|
|
|
486
487
|
await act(async () => {
|
|
487
488
|
stdin.write('\t'); // Press Tab
|
|
488
489
|
});
|
|
489
|
-
await
|
|
490
|
+
await waitFor(() =>
|
|
490
491
|
// It should NOT become '/show'. It should correctly become '/memory show'.
|
|
491
492
|
expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(0));
|
|
492
493
|
unmount();
|
|
@@ -504,7 +505,7 @@ describe('InputPrompt', () => {
|
|
|
504
505
|
await act(async () => {
|
|
505
506
|
stdin.write('\t'); // Press Tab
|
|
506
507
|
});
|
|
507
|
-
await
|
|
508
|
+
await waitFor(() => expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(0));
|
|
508
509
|
unmount();
|
|
509
510
|
});
|
|
510
511
|
it('should autocomplete on Enter when suggestions are active, without submitting', async () => {
|
|
@@ -519,7 +520,7 @@ describe('InputPrompt', () => {
|
|
|
519
520
|
await act(async () => {
|
|
520
521
|
stdin.write('\r');
|
|
521
522
|
});
|
|
522
|
-
await
|
|
523
|
+
await waitFor(() => {
|
|
523
524
|
// The app should autocomplete the text, NOT submit.
|
|
524
525
|
expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(0);
|
|
525
526
|
});
|
|
@@ -546,7 +547,7 @@ describe('InputPrompt', () => {
|
|
|
546
547
|
await act(async () => {
|
|
547
548
|
stdin.write('\t'); // Press Tab for autocomplete
|
|
548
549
|
});
|
|
549
|
-
await
|
|
550
|
+
await waitFor(() => expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(0));
|
|
550
551
|
unmount();
|
|
551
552
|
});
|
|
552
553
|
it('should not submit on Enter when the buffer is empty or only contains whitespace', async () => {
|
|
@@ -555,8 +556,9 @@ describe('InputPrompt', () => {
|
|
|
555
556
|
await act(async () => {
|
|
556
557
|
stdin.write('\r'); // Press Enter
|
|
557
558
|
});
|
|
558
|
-
await
|
|
559
|
-
|
|
559
|
+
await waitFor(() => {
|
|
560
|
+
expect(props.onSubmit).not.toHaveBeenCalled();
|
|
561
|
+
});
|
|
560
562
|
unmount();
|
|
561
563
|
});
|
|
562
564
|
it('should submit directly on Enter when isPerfectMatch is true', async () => {
|
|
@@ -570,7 +572,7 @@ describe('InputPrompt', () => {
|
|
|
570
572
|
await act(async () => {
|
|
571
573
|
stdin.write('\r');
|
|
572
574
|
});
|
|
573
|
-
await
|
|
575
|
+
await waitFor(() => expect(props.onSubmit).toHaveBeenCalledWith('/clear'));
|
|
574
576
|
unmount();
|
|
575
577
|
});
|
|
576
578
|
it('should submit directly on Enter when a complete leaf command is typed', async () => {
|
|
@@ -584,7 +586,7 @@ describe('InputPrompt', () => {
|
|
|
584
586
|
await act(async () => {
|
|
585
587
|
stdin.write('\r');
|
|
586
588
|
});
|
|
587
|
-
await
|
|
589
|
+
await waitFor(() => expect(props.onSubmit).toHaveBeenCalledWith('/clear'));
|
|
588
590
|
unmount();
|
|
589
591
|
});
|
|
590
592
|
it('should autocomplete an @-path on Enter without submitting', async () => {
|
|
@@ -599,7 +601,7 @@ describe('InputPrompt', () => {
|
|
|
599
601
|
await act(async () => {
|
|
600
602
|
stdin.write('\r');
|
|
601
603
|
});
|
|
602
|
-
await
|
|
604
|
+
await waitFor(() => expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(0));
|
|
603
605
|
expect(props.onSubmit).not.toHaveBeenCalled();
|
|
604
606
|
unmount();
|
|
605
607
|
});
|
|
@@ -612,7 +614,7 @@ describe('InputPrompt', () => {
|
|
|
612
614
|
await act(async () => {
|
|
613
615
|
stdin.write('\r');
|
|
614
616
|
});
|
|
615
|
-
await
|
|
617
|
+
await waitFor(() => {
|
|
616
618
|
expect(props.buffer.backspace).toHaveBeenCalled();
|
|
617
619
|
expect(props.buffer.newline).toHaveBeenCalled();
|
|
618
620
|
});
|
|
@@ -620,12 +622,14 @@ describe('InputPrompt', () => {
|
|
|
620
622
|
unmount();
|
|
621
623
|
});
|
|
622
624
|
it('should clear the buffer on Ctrl+C if it has text', async () => {
|
|
623
|
-
|
|
625
|
+
await act(async () => {
|
|
626
|
+
props.buffer.setText('some text to clear');
|
|
627
|
+
});
|
|
624
628
|
const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
|
|
625
629
|
await act(async () => {
|
|
626
630
|
stdin.write('\x03'); // Ctrl+C character
|
|
627
631
|
});
|
|
628
|
-
await
|
|
632
|
+
await waitFor(() => {
|
|
629
633
|
expect(props.buffer.setText).toHaveBeenCalledWith('');
|
|
630
634
|
expect(mockCommandCompletion.resetCompletionState).toHaveBeenCalled();
|
|
631
635
|
});
|
|
@@ -638,8 +642,9 @@ describe('InputPrompt', () => {
|
|
|
638
642
|
await act(async () => {
|
|
639
643
|
stdin.write('\x03'); // Ctrl+C character
|
|
640
644
|
});
|
|
641
|
-
await
|
|
642
|
-
|
|
645
|
+
await waitFor(() => {
|
|
646
|
+
expect(props.buffer.setText).not.toHaveBeenCalled();
|
|
647
|
+
});
|
|
643
648
|
unmount();
|
|
644
649
|
});
|
|
645
650
|
describe('cursor-based completion trigger', () => {
|
|
@@ -734,7 +739,7 @@ describe('InputPrompt', () => {
|
|
|
734
739
|
: [],
|
|
735
740
|
});
|
|
736
741
|
const { unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
|
|
737
|
-
await
|
|
742
|
+
await waitFor(() => {
|
|
738
743
|
expect(mockedUseCommandCompletion).toHaveBeenCalledWith(mockBuffer, ['/test/project/src'], path.join('test', 'project', 'src'), mockSlashCommands, mockCommandContext, false, false, expect.any(Object));
|
|
739
744
|
});
|
|
740
745
|
unmount();
|
|
@@ -747,7 +752,7 @@ describe('InputPrompt', () => {
|
|
|
747
752
|
await act(async () => {
|
|
748
753
|
stdin.write('i');
|
|
749
754
|
});
|
|
750
|
-
await
|
|
755
|
+
await waitFor(() => {
|
|
751
756
|
expect(props.vimHandleInput).toHaveBeenCalled();
|
|
752
757
|
});
|
|
753
758
|
expect(mockBuffer.handleInput).not.toHaveBeenCalled();
|
|
@@ -759,7 +764,7 @@ describe('InputPrompt', () => {
|
|
|
759
764
|
await act(async () => {
|
|
760
765
|
stdin.write('i');
|
|
761
766
|
});
|
|
762
|
-
await
|
|
767
|
+
await waitFor(() => {
|
|
763
768
|
expect(props.vimHandleInput).toHaveBeenCalled();
|
|
764
769
|
expect(mockBuffer.handleInput).toHaveBeenCalled();
|
|
765
770
|
});
|
|
@@ -772,7 +777,7 @@ describe('InputPrompt', () => {
|
|
|
772
777
|
await act(async () => {
|
|
773
778
|
stdin.write('i');
|
|
774
779
|
});
|
|
775
|
-
await
|
|
780
|
+
await waitFor(() => {
|
|
776
781
|
expect(props.vimHandleInput).toHaveBeenCalled();
|
|
777
782
|
expect(mockBuffer.handleInput).toHaveBeenCalled();
|
|
778
783
|
});
|
|
@@ -786,7 +791,7 @@ describe('InputPrompt', () => {
|
|
|
786
791
|
await act(async () => {
|
|
787
792
|
stdin.write('\x1B[200~pasted text\x1B[201~');
|
|
788
793
|
});
|
|
789
|
-
await
|
|
794
|
+
await waitFor(() => {
|
|
790
795
|
expect(mockBuffer.handleInput).toHaveBeenCalledWith(expect.objectContaining({
|
|
791
796
|
paste: true,
|
|
792
797
|
sequence: 'pasted text',
|
|
@@ -800,7 +805,7 @@ describe('InputPrompt', () => {
|
|
|
800
805
|
await act(async () => {
|
|
801
806
|
stdin.write('a');
|
|
802
807
|
});
|
|
803
|
-
await
|
|
808
|
+
await waitFor(() => { });
|
|
804
809
|
expect(mockBuffer.handleInput).not.toHaveBeenCalled();
|
|
805
810
|
unmount();
|
|
806
811
|
});
|
|
@@ -862,7 +867,7 @@ describe('InputPrompt', () => {
|
|
|
862
867
|
mockBuffer.viewportVisualLines = [text];
|
|
863
868
|
mockBuffer.visualCursor = visualCursor;
|
|
864
869
|
const { stdout, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
|
|
865
|
-
await
|
|
870
|
+
await waitFor(() => {
|
|
866
871
|
const frame = stdout.lastFrame();
|
|
867
872
|
expect(frame).toContain(expected);
|
|
868
873
|
});
|
|
@@ -909,7 +914,7 @@ describe('InputPrompt', () => {
|
|
|
909
914
|
mockBuffer.visualCursor = visualCursor;
|
|
910
915
|
mockBuffer.visualToLogicalMap = visualToLogicalMap;
|
|
911
916
|
const { stdout, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
|
|
912
|
-
await
|
|
917
|
+
await waitFor(() => {
|
|
913
918
|
const frame = stdout.lastFrame();
|
|
914
919
|
expect(frame).toContain(expected);
|
|
915
920
|
});
|
|
@@ -927,7 +932,7 @@ describe('InputPrompt', () => {
|
|
|
927
932
|
[2, 0],
|
|
928
933
|
];
|
|
929
934
|
const { stdout, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
|
|
930
|
-
await
|
|
935
|
+
await waitFor(() => {
|
|
931
936
|
const frame = stdout.lastFrame();
|
|
932
937
|
const lines = frame.split('\n');
|
|
933
938
|
// The line with the cursor should just be an inverted space inside the box border
|
|
@@ -952,7 +957,7 @@ describe('InputPrompt', () => {
|
|
|
952
957
|
[2, 0], // 'world' is logical line 2, col 0
|
|
953
958
|
];
|
|
954
959
|
const { stdout, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
|
|
955
|
-
await
|
|
960
|
+
await waitFor(() => {
|
|
956
961
|
const frame = stdout.lastFrame();
|
|
957
962
|
// Check that all lines, including the empty one, are rendered.
|
|
958
963
|
// This implicitly tests that the Box wrapper provides height for the empty line.
|
|
@@ -985,7 +990,7 @@ describe('InputPrompt', () => {
|
|
|
985
990
|
await act(async () => {
|
|
986
991
|
stdin.write(`\x1b[200~${pastedText}\x1b[201~`);
|
|
987
992
|
});
|
|
988
|
-
await
|
|
993
|
+
await waitFor(() => {
|
|
989
994
|
// Verify that the buffer's handleInput was called once with the full text
|
|
990
995
|
expect(props.buffer.handleInput).toHaveBeenCalledTimes(1);
|
|
991
996
|
expect(props.buffer.handleInput).toHaveBeenCalledWith(expect.objectContaining({
|
|
@@ -1012,7 +1017,9 @@ describe('InputPrompt', () => {
|
|
|
1012
1017
|
// isTerminalPasteTrusted will be false due to beforeEach setup.
|
|
1013
1018
|
props.buffer.text = 'some command';
|
|
1014
1019
|
const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
|
|
1015
|
-
await
|
|
1020
|
+
await act(async () => {
|
|
1021
|
+
await vi.runAllTimersAsync();
|
|
1022
|
+
});
|
|
1016
1023
|
// Simulate a paste operation (this should set the paste protection)
|
|
1017
1024
|
await act(async () => {
|
|
1018
1025
|
stdin.write(`\x1b[200~pasted content\x1b[201~`);
|
|
@@ -1021,7 +1028,9 @@ describe('InputPrompt', () => {
|
|
|
1021
1028
|
await act(async () => {
|
|
1022
1029
|
stdin.write('\r');
|
|
1023
1030
|
});
|
|
1024
|
-
await
|
|
1031
|
+
await act(async () => {
|
|
1032
|
+
await vi.runAllTimersAsync();
|
|
1033
|
+
});
|
|
1025
1034
|
// Verify that onSubmit was NOT called due to recent paste protection
|
|
1026
1035
|
expect(props.onSubmit).not.toHaveBeenCalled();
|
|
1027
1036
|
// It should call newline() instead
|
|
@@ -1032,12 +1041,16 @@ describe('InputPrompt', () => {
|
|
|
1032
1041
|
// isTerminalPasteTrusted will be false due to beforeEach setup.
|
|
1033
1042
|
props.buffer.text = 'pasted text';
|
|
1034
1043
|
const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
|
|
1035
|
-
await
|
|
1044
|
+
await act(async () => {
|
|
1045
|
+
await vi.runAllTimersAsync();
|
|
1046
|
+
});
|
|
1036
1047
|
// Simulate a paste operation (this sets the protection)
|
|
1037
1048
|
await act(async () => {
|
|
1038
1049
|
stdin.write('\x1b[200~pasted text\x1b[201~');
|
|
1039
1050
|
});
|
|
1040
|
-
await
|
|
1051
|
+
await act(async () => {
|
|
1052
|
+
await vi.runAllTimersAsync();
|
|
1053
|
+
});
|
|
1041
1054
|
// Advance timers past the protection timeout
|
|
1042
1055
|
await act(async () => {
|
|
1043
1056
|
await vi.advanceTimersByTimeAsync(50);
|
|
@@ -1046,7 +1059,9 @@ describe('InputPrompt', () => {
|
|
|
1046
1059
|
await act(async () => {
|
|
1047
1060
|
stdin.write('\r');
|
|
1048
1061
|
});
|
|
1049
|
-
await
|
|
1062
|
+
await act(async () => {
|
|
1063
|
+
await vi.runAllTimersAsync();
|
|
1064
|
+
});
|
|
1050
1065
|
expect(props.onSubmit).toHaveBeenCalledWith('pasted text');
|
|
1051
1066
|
expect(props.buffer.newline).not.toHaveBeenCalled();
|
|
1052
1067
|
unmount();
|
|
@@ -1064,17 +1079,23 @@ describe('InputPrompt', () => {
|
|
|
1064
1079
|
setup();
|
|
1065
1080
|
props.buffer.text = 'pasted command';
|
|
1066
1081
|
const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }), { kittyProtocolEnabled: true });
|
|
1067
|
-
await
|
|
1082
|
+
await act(async () => {
|
|
1083
|
+
await vi.runAllTimersAsync();
|
|
1084
|
+
});
|
|
1068
1085
|
// Simulate a paste operation
|
|
1069
1086
|
await act(async () => {
|
|
1070
1087
|
stdin.write('\x1b[200~some pasted stuff\x1b[201~');
|
|
1071
1088
|
});
|
|
1072
|
-
await
|
|
1089
|
+
await act(async () => {
|
|
1090
|
+
await vi.runAllTimersAsync();
|
|
1091
|
+
});
|
|
1073
1092
|
// Simulate an Enter key press immediately after paste
|
|
1074
1093
|
await act(async () => {
|
|
1075
1094
|
stdin.write('\r');
|
|
1076
1095
|
});
|
|
1077
|
-
await
|
|
1096
|
+
await act(async () => {
|
|
1097
|
+
await vi.runAllTimersAsync();
|
|
1098
|
+
});
|
|
1078
1099
|
// Verify that onSubmit was called
|
|
1079
1100
|
expect(props.onSubmit).toHaveBeenCalledWith('pasted command');
|
|
1080
1101
|
unmount();
|
|
@@ -1083,12 +1104,16 @@ describe('InputPrompt', () => {
|
|
|
1083
1104
|
// Set up buffer with text before rendering to ensure submission works
|
|
1084
1105
|
props.buffer.text = 'normal command';
|
|
1085
1106
|
const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
|
|
1086
|
-
await
|
|
1107
|
+
await act(async () => {
|
|
1108
|
+
await vi.runAllTimersAsync();
|
|
1109
|
+
});
|
|
1087
1110
|
// Press Enter without any recent paste
|
|
1088
1111
|
await act(async () => {
|
|
1089
1112
|
stdin.write('\r');
|
|
1090
1113
|
});
|
|
1091
|
-
await
|
|
1114
|
+
await act(async () => {
|
|
1115
|
+
await vi.runAllTimersAsync();
|
|
1116
|
+
});
|
|
1092
1117
|
// Verify that onSubmit was called normally
|
|
1093
1118
|
expect(props.onSubmit).toHaveBeenCalledWith('normal command');
|
|
1094
1119
|
unmount();
|
|
@@ -1102,16 +1127,16 @@ describe('InputPrompt', () => {
|
|
|
1102
1127
|
const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }), { kittyProtocolEnabled: false });
|
|
1103
1128
|
await act(async () => {
|
|
1104
1129
|
stdin.write('\x1B');
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1130
|
+
await waitFor(() => {
|
|
1131
|
+
expect(onEscapePromptChange).toHaveBeenCalledWith(false);
|
|
1132
|
+
});
|
|
1108
1133
|
});
|
|
1109
1134
|
await act(async () => {
|
|
1110
1135
|
stdin.write('\x1B');
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1136
|
+
await waitFor(() => {
|
|
1137
|
+
expect(props.buffer.setText).toHaveBeenCalledWith('');
|
|
1138
|
+
expect(mockCommandCompletion.resetCompletionState).toHaveBeenCalled();
|
|
1139
|
+
});
|
|
1115
1140
|
});
|
|
1116
1141
|
unmount();
|
|
1117
1142
|
});
|
|
@@ -1122,15 +1147,15 @@ describe('InputPrompt', () => {
|
|
|
1122
1147
|
const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }), { kittyProtocolEnabled: false });
|
|
1123
1148
|
await act(async () => {
|
|
1124
1149
|
stdin.write('\x1B');
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1150
|
+
await waitFor(() => {
|
|
1151
|
+
expect(onEscapePromptChange).toHaveBeenCalledWith(false);
|
|
1152
|
+
});
|
|
1128
1153
|
});
|
|
1129
1154
|
await act(async () => {
|
|
1130
1155
|
stdin.write('a');
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1156
|
+
await waitFor(() => {
|
|
1157
|
+
expect(onEscapePromptChange).toHaveBeenCalledWith(false);
|
|
1158
|
+
});
|
|
1134
1159
|
});
|
|
1135
1160
|
unmount();
|
|
1136
1161
|
});
|
|
@@ -1139,8 +1164,8 @@ describe('InputPrompt', () => {
|
|
|
1139
1164
|
const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }), { kittyProtocolEnabled: false });
|
|
1140
1165
|
await act(async () => {
|
|
1141
1166
|
stdin.write('\x1B');
|
|
1167
|
+
await waitFor(() => expect(props.setShellModeActive).toHaveBeenCalledWith(false));
|
|
1142
1168
|
});
|
|
1143
|
-
await vi.waitFor(() => expect(props.setShellModeActive).toHaveBeenCalledWith(false));
|
|
1144
1169
|
unmount();
|
|
1145
1170
|
});
|
|
1146
1171
|
it('should handle ESC when completion suggestions are showing', async () => {
|
|
@@ -1153,7 +1178,7 @@ describe('InputPrompt', () => {
|
|
|
1153
1178
|
await act(async () => {
|
|
1154
1179
|
stdin.write('\x1B');
|
|
1155
1180
|
});
|
|
1156
|
-
await
|
|
1181
|
+
await waitFor(() => expect(mockCommandCompletion.resetCompletionState).toHaveBeenCalled());
|
|
1157
1182
|
unmount();
|
|
1158
1183
|
});
|
|
1159
1184
|
it('should not call onEscapePromptChange when not provided', async () => {
|
|
@@ -1161,11 +1186,15 @@ describe('InputPrompt', () => {
|
|
|
1161
1186
|
props.onEscapePromptChange = undefined;
|
|
1162
1187
|
props.buffer.setText('some text');
|
|
1163
1188
|
const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }), { kittyProtocolEnabled: false });
|
|
1164
|
-
await
|
|
1189
|
+
await act(async () => {
|
|
1190
|
+
await vi.runAllTimersAsync();
|
|
1191
|
+
});
|
|
1165
1192
|
await act(async () => {
|
|
1166
1193
|
stdin.write('\x1B');
|
|
1167
1194
|
});
|
|
1168
|
-
await
|
|
1195
|
+
await act(async () => {
|
|
1196
|
+
await vi.runAllTimersAsync();
|
|
1197
|
+
});
|
|
1169
1198
|
vi.useRealTimers();
|
|
1170
1199
|
unmount();
|
|
1171
1200
|
});
|
|
@@ -1174,11 +1203,11 @@ describe('InputPrompt', () => {
|
|
|
1174
1203
|
await act(async () => {
|
|
1175
1204
|
stdin.write('\x0C');
|
|
1176
1205
|
});
|
|
1177
|
-
await
|
|
1206
|
+
await waitFor(() => expect(props.onClearScreen).toHaveBeenCalled());
|
|
1178
1207
|
await act(async () => {
|
|
1179
1208
|
stdin.write('\x01');
|
|
1180
1209
|
});
|
|
1181
|
-
await
|
|
1210
|
+
await waitFor(() => expect(props.buffer.move).toHaveBeenCalledWith('home'));
|
|
1182
1211
|
unmount();
|
|
1183
1212
|
});
|
|
1184
1213
|
});
|
|
@@ -1210,7 +1239,7 @@ describe('InputPrompt', () => {
|
|
|
1210
1239
|
await act(async () => {
|
|
1211
1240
|
stdin.write('\x12');
|
|
1212
1241
|
});
|
|
1213
|
-
await
|
|
1242
|
+
await waitFor(() => {
|
|
1214
1243
|
const frame = stdout.lastFrame();
|
|
1215
1244
|
expect(frame).toContain('(r:)');
|
|
1216
1245
|
expect(frame).toContain('echo hello');
|
|
@@ -1224,17 +1253,16 @@ describe('InputPrompt', () => {
|
|
|
1224
1253
|
await act(async () => {
|
|
1225
1254
|
stdin.write('\x12');
|
|
1226
1255
|
});
|
|
1227
|
-
await vi.waitFor(() => { });
|
|
1228
1256
|
await act(async () => {
|
|
1229
1257
|
stdin.write('\x1B');
|
|
1230
1258
|
});
|
|
1231
1259
|
await act(async () => {
|
|
1232
1260
|
stdin.write('\u001b[27u'); // Press kitty escape key
|
|
1233
1261
|
});
|
|
1234
|
-
await
|
|
1262
|
+
await waitFor(() => {
|
|
1235
1263
|
expect(stdout.lastFrame()).not.toContain('(r:)');
|
|
1264
|
+
expect(stdout.lastFrame()).not.toContain('echo hello');
|
|
1236
1265
|
});
|
|
1237
|
-
expect(stdout.lastFrame()).not.toContain('echo hello');
|
|
1238
1266
|
unmount();
|
|
1239
1267
|
});
|
|
1240
1268
|
it('completes the highlighted entry on Tab and exits reverse-search', async () => {
|
|
@@ -1261,14 +1289,14 @@ describe('InputPrompt', () => {
|
|
|
1261
1289
|
stdin.write('\x12');
|
|
1262
1290
|
});
|
|
1263
1291
|
// Verify reverse search is active
|
|
1264
|
-
await
|
|
1292
|
+
await waitFor(() => {
|
|
1265
1293
|
expect(stdout.lastFrame()).toContain('(r:)');
|
|
1266
1294
|
});
|
|
1267
1295
|
// Press Tab to complete the highlighted entry
|
|
1268
1296
|
await act(async () => {
|
|
1269
1297
|
stdin.write('\t');
|
|
1270
1298
|
});
|
|
1271
|
-
await
|
|
1299
|
+
await waitFor(() => {
|
|
1272
1300
|
expect(mockHandleAutocomplete).toHaveBeenCalledWith(0);
|
|
1273
1301
|
expect(props.buffer.setText).toHaveBeenCalledWith('echo hello');
|
|
1274
1302
|
});
|
|
@@ -1290,13 +1318,13 @@ describe('InputPrompt', () => {
|
|
|
1290
1318
|
await act(async () => {
|
|
1291
1319
|
stdin.write('\x12');
|
|
1292
1320
|
});
|
|
1293
|
-
await
|
|
1321
|
+
await waitFor(() => {
|
|
1294
1322
|
expect(stdout.lastFrame()).toContain('(r:)');
|
|
1295
1323
|
});
|
|
1296
1324
|
await act(async () => {
|
|
1297
1325
|
stdin.write('\r');
|
|
1298
1326
|
});
|
|
1299
|
-
await
|
|
1327
|
+
await waitFor(() => {
|
|
1300
1328
|
expect(stdout.lastFrame()).not.toContain('(r:)');
|
|
1301
1329
|
});
|
|
1302
1330
|
expect(props.onSubmit).toHaveBeenCalledWith('echo hello');
|
|
@@ -1320,14 +1348,14 @@ describe('InputPrompt', () => {
|
|
|
1320
1348
|
await act(async () => {
|
|
1321
1349
|
stdin.write('\x12');
|
|
1322
1350
|
});
|
|
1323
|
-
await
|
|
1351
|
+
await waitFor(() => {
|
|
1324
1352
|
expect(stdout.lastFrame()).toContain('(r:)');
|
|
1325
1353
|
});
|
|
1326
1354
|
// Press kitty escape key
|
|
1327
1355
|
await act(async () => {
|
|
1328
1356
|
stdin.write('\u001b[27u');
|
|
1329
1357
|
});
|
|
1330
|
-
await
|
|
1358
|
+
await waitFor(() => {
|
|
1331
1359
|
expect(stdout.lastFrame()).not.toContain('(r:)');
|
|
1332
1360
|
expect(props.buffer.text).toBe(initialText);
|
|
1333
1361
|
expect(props.buffer.cursor).toEqual(initialCursor);
|
|
@@ -1344,7 +1372,7 @@ describe('InputPrompt', () => {
|
|
|
1344
1372
|
await act(async () => {
|
|
1345
1373
|
stdin.write('\x05'); // Ctrl+E
|
|
1346
1374
|
});
|
|
1347
|
-
await
|
|
1375
|
+
await waitFor(() => {
|
|
1348
1376
|
expect(props.buffer.move).toHaveBeenCalledWith('end');
|
|
1349
1377
|
});
|
|
1350
1378
|
expect(props.buffer.moveToOffset).not.toHaveBeenCalled();
|
|
@@ -1358,7 +1386,7 @@ describe('InputPrompt', () => {
|
|
|
1358
1386
|
await act(async () => {
|
|
1359
1387
|
stdin.write('\x05'); // Ctrl+E
|
|
1360
1388
|
});
|
|
1361
|
-
await
|
|
1389
|
+
await waitFor(() => {
|
|
1362
1390
|
expect(props.buffer.move).toHaveBeenCalledWith('end');
|
|
1363
1391
|
});
|
|
1364
1392
|
expect(props.buffer.moveToOffset).not.toHaveBeenCalled();
|
|
@@ -1383,7 +1411,7 @@ describe('InputPrompt', () => {
|
|
|
1383
1411
|
await act(async () => {
|
|
1384
1412
|
stdin.write('\x12'); // Ctrl+R
|
|
1385
1413
|
});
|
|
1386
|
-
await
|
|
1414
|
+
await waitFor(() => {
|
|
1387
1415
|
const frame = stdout.lastFrame() ?? '';
|
|
1388
1416
|
expect(frame).toContain('(r:)');
|
|
1389
1417
|
expect(frame).toContain('git commit');
|
|
@@ -1406,20 +1434,20 @@ describe('InputPrompt', () => {
|
|
|
1406
1434
|
await act(async () => {
|
|
1407
1435
|
stdin.write('\x12');
|
|
1408
1436
|
});
|
|
1409
|
-
await
|
|
1437
|
+
await waitFor(() => {
|
|
1410
1438
|
expect(clean(stdout.lastFrame())).toContain('→');
|
|
1411
1439
|
});
|
|
1412
1440
|
await act(async () => {
|
|
1413
1441
|
stdin.write('\u001B[C');
|
|
1414
1442
|
});
|
|
1415
|
-
await
|
|
1443
|
+
await waitFor(() => {
|
|
1416
1444
|
expect(clean(stdout.lastFrame())).toContain('←');
|
|
1417
1445
|
});
|
|
1418
1446
|
expect(stdout.lastFrame()).toMatchSnapshot('command-search-render-expanded-match');
|
|
1419
1447
|
await act(async () => {
|
|
1420
1448
|
stdin.write('\u001B[D');
|
|
1421
1449
|
});
|
|
1422
|
-
await
|
|
1450
|
+
await waitFor(() => {
|
|
1423
1451
|
expect(clean(stdout.lastFrame())).toContain('→');
|
|
1424
1452
|
});
|
|
1425
1453
|
expect(stdout.lastFrame()).toMatchSnapshot('command-search-render-collapsed-match');
|
|
@@ -1442,13 +1470,13 @@ describe('InputPrompt', () => {
|
|
|
1442
1470
|
await act(async () => {
|
|
1443
1471
|
stdin.write('\x12');
|
|
1444
1472
|
});
|
|
1445
|
-
await
|
|
1473
|
+
await waitFor(() => {
|
|
1446
1474
|
expect(stdout.lastFrame()).toMatchSnapshot('command-search-render-collapsed-match');
|
|
1447
1475
|
});
|
|
1448
1476
|
await act(async () => {
|
|
1449
1477
|
stdin.write('\u001B[C');
|
|
1450
1478
|
});
|
|
1451
|
-
await
|
|
1479
|
+
await waitFor(() => {
|
|
1452
1480
|
expect(stdout.lastFrame()).toMatchSnapshot('command-search-render-expanded-match');
|
|
1453
1481
|
});
|
|
1454
1482
|
unmount();
|
|
@@ -1468,7 +1496,7 @@ describe('InputPrompt', () => {
|
|
|
1468
1496
|
await act(async () => {
|
|
1469
1497
|
stdin.write('\x12');
|
|
1470
1498
|
});
|
|
1471
|
-
await
|
|
1499
|
+
await waitFor(() => {
|
|
1472
1500
|
const frame = clean(stdout.lastFrame());
|
|
1473
1501
|
// Ensure it rendered the search mode
|
|
1474
1502
|
expect(frame).toContain('(r:)');
|
|
@@ -1487,7 +1515,7 @@ describe('InputPrompt', () => {
|
|
|
1487
1515
|
await act(async () => {
|
|
1488
1516
|
stdin.write('\u001B[A');
|
|
1489
1517
|
});
|
|
1490
|
-
await
|
|
1518
|
+
await waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
|
|
1491
1519
|
const callback = mockPopAllMessages.mock.calls[0][0];
|
|
1492
1520
|
await act(async () => {
|
|
1493
1521
|
callback('Message 1\n\nMessage 2\n\nMessage 3');
|
|
@@ -1503,7 +1531,7 @@ describe('InputPrompt', () => {
|
|
|
1503
1531
|
await act(async () => {
|
|
1504
1532
|
stdin.write('\u001B[A');
|
|
1505
1533
|
});
|
|
1506
|
-
await
|
|
1534
|
+
await waitFor(() => expect(mockInputHistory.navigateUp).toHaveBeenCalled());
|
|
1507
1535
|
expect(mockPopAllMessages).not.toHaveBeenCalled();
|
|
1508
1536
|
unmount();
|
|
1509
1537
|
});
|
|
@@ -1515,7 +1543,7 @@ describe('InputPrompt', () => {
|
|
|
1515
1543
|
await act(async () => {
|
|
1516
1544
|
stdin.write('\u001B[A');
|
|
1517
1545
|
});
|
|
1518
|
-
await
|
|
1546
|
+
await waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
|
|
1519
1547
|
const callback = mockPopAllMessages.mock.calls[0][0];
|
|
1520
1548
|
await act(async () => {
|
|
1521
1549
|
callback(undefined);
|
|
@@ -1535,7 +1563,7 @@ describe('InputPrompt', () => {
|
|
|
1535
1563
|
await act(async () => {
|
|
1536
1564
|
stdin.write('\u001B[A');
|
|
1537
1565
|
});
|
|
1538
|
-
await
|
|
1566
|
+
await waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
|
|
1539
1567
|
unmount();
|
|
1540
1568
|
});
|
|
1541
1569
|
it('should handle single queued message', async () => {
|
|
@@ -1546,7 +1574,7 @@ describe('InputPrompt', () => {
|
|
|
1546
1574
|
await act(async () => {
|
|
1547
1575
|
stdin.write('\u001B[A');
|
|
1548
1576
|
});
|
|
1549
|
-
await
|
|
1577
|
+
await waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
|
|
1550
1578
|
const callback = mockPopAllMessages.mock.calls[0][0];
|
|
1551
1579
|
await act(async () => {
|
|
1552
1580
|
callback('Single message');
|
|
@@ -1562,7 +1590,7 @@ describe('InputPrompt', () => {
|
|
|
1562
1590
|
await act(async () => {
|
|
1563
1591
|
stdin.write('\u001B[A');
|
|
1564
1592
|
});
|
|
1565
|
-
await
|
|
1593
|
+
await waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
|
|
1566
1594
|
unmount();
|
|
1567
1595
|
});
|
|
1568
1596
|
it('should not call popAllMessages if it is not provided', async () => {
|
|
@@ -1572,7 +1600,7 @@ describe('InputPrompt', () => {
|
|
|
1572
1600
|
await act(async () => {
|
|
1573
1601
|
stdin.write('\u001B[A');
|
|
1574
1602
|
});
|
|
1575
|
-
await
|
|
1603
|
+
await waitFor(() => expect(mockInputHistory.navigateUp).toHaveBeenCalled());
|
|
1576
1604
|
unmount();
|
|
1577
1605
|
});
|
|
1578
1606
|
it('should navigate input history on fresh start when no queued messages exist', async () => {
|
|
@@ -1583,7 +1611,7 @@ describe('InputPrompt', () => {
|
|
|
1583
1611
|
await act(async () => {
|
|
1584
1612
|
stdin.write('\u001B[A');
|
|
1585
1613
|
});
|
|
1586
|
-
await
|
|
1614
|
+
await waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
|
|
1587
1615
|
const callback = mockPopAllMessages.mock.calls[0][0];
|
|
1588
1616
|
await act(async () => {
|
|
1589
1617
|
callback(undefined);
|
|
@@ -1597,26 +1625,26 @@ describe('InputPrompt', () => {
|
|
|
1597
1625
|
it('should render correctly in shell mode', async () => {
|
|
1598
1626
|
props.shellModeActive = true;
|
|
1599
1627
|
const { stdout, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
|
|
1600
|
-
await
|
|
1628
|
+
await waitFor(() => expect(stdout.lastFrame()).toMatchSnapshot());
|
|
1601
1629
|
unmount();
|
|
1602
1630
|
});
|
|
1603
1631
|
it('should render correctly when accepting edits', async () => {
|
|
1604
1632
|
props.approvalMode = ApprovalMode.AUTO_EDIT;
|
|
1605
1633
|
const { stdout, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
|
|
1606
|
-
await
|
|
1634
|
+
await waitFor(() => expect(stdout.lastFrame()).toMatchSnapshot());
|
|
1607
1635
|
unmount();
|
|
1608
1636
|
});
|
|
1609
1637
|
it('should render correctly in yolo mode', async () => {
|
|
1610
1638
|
props.approvalMode = ApprovalMode.YOLO;
|
|
1611
1639
|
const { stdout, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
|
|
1612
|
-
await
|
|
1640
|
+
await waitFor(() => expect(stdout.lastFrame()).toMatchSnapshot());
|
|
1613
1641
|
unmount();
|
|
1614
1642
|
});
|
|
1615
1643
|
it('should not show inverted cursor when shell is focused', async () => {
|
|
1616
1644
|
props.isEmbeddedShellFocused = true;
|
|
1617
1645
|
props.focus = false;
|
|
1618
1646
|
const { stdout, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
|
|
1619
|
-
await
|
|
1647
|
+
await waitFor(() => {
|
|
1620
1648
|
expect(stdout.lastFrame()).not.toContain(`{chalk.inverse(' ')}`);
|
|
1621
1649
|
// This snapshot is good to make sure there was an input prompt but does
|
|
1622
1650
|
// not show the inverted cursor because snapshots do not show colors.
|
|
@@ -1632,7 +1660,7 @@ describe('InputPrompt', () => {
|
|
|
1632
1660
|
await act(async () => {
|
|
1633
1661
|
stdin.write('a');
|
|
1634
1662
|
});
|
|
1635
|
-
await
|
|
1663
|
+
await waitFor(() => expect(mockBuffer.handleInput).toHaveBeenCalled());
|
|
1636
1664
|
unmount();
|
|
1637
1665
|
});
|
|
1638
1666
|
describe('command queuing while streaming', () => {
|
|
@@ -1670,7 +1698,7 @@ describe('InputPrompt', () => {
|
|
|
1670
1698
|
await act(async () => {
|
|
1671
1699
|
stdin.write('\r');
|
|
1672
1700
|
});
|
|
1673
|
-
await
|
|
1701
|
+
await waitFor(() => {
|
|
1674
1702
|
if (shouldSubmit) {
|
|
1675
1703
|
expect(props.onSubmit).toHaveBeenCalledWith(bufferText);
|
|
1676
1704
|
expect(props.setQueueErrorMessage).not.toHaveBeenCalled();
|