fix: /help remove flickering and respect clear shortcut (ctr+l) (#3611)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
Co-authored-by: Allen Hutchison <adh@google.com>
This commit is contained in:
Pyush Sinha
2025-08-04 09:53:50 -07:00
committed by GitHub
parent 83a04c4755
commit e506b40c27
10 changed files with 72 additions and 70 deletions

View File

@@ -90,7 +90,7 @@ describe('useSlashCommandProcessor', () => {
const mockAddItem = vi.fn();
const mockClearItems = vi.fn();
const mockLoadHistory = vi.fn();
const mockSetShowHelp = vi.fn();
const mockOpenThemeDialog = vi.fn();
const mockOpenAuthDialog = vi.fn();
const mockSetQuittingMessages = vi.fn();
@@ -132,9 +132,8 @@ describe('useSlashCommandProcessor', () => {
mockClearItems,
mockLoadHistory,
vi.fn(), // refreshStatic
mockSetShowHelp,
vi.fn(), // onDebugMessage
vi.fn(), // openThemeDialog
mockOpenThemeDialog, // openThemeDialog
mockOpenAuthDialog,
vi.fn(), // openEditorDialog
vi.fn(), // toggleCorgiMode
@@ -334,19 +333,19 @@ describe('useSlashCommandProcessor', () => {
});
describe('Action Result Handling', () => {
it('should handle "dialog: help" action', async () => {
it('should handle "dialog: theme" action', async () => {
const command = createTestCommand({
name: 'helpcmd',
action: vi.fn().mockResolvedValue({ type: 'dialog', dialog: 'help' }),
name: 'themecmd',
action: vi.fn().mockResolvedValue({ type: 'dialog', dialog: 'theme' }),
});
const result = setupProcessorHook([command]);
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
await act(async () => {
await result.current.handleSlashCommand('/helpcmd');
await result.current.handleSlashCommand('/themecmd');
});
expect(mockSetShowHelp).toHaveBeenCalledWith(true);
expect(mockOpenThemeDialog).toHaveBeenCalled();
});
it('should handle "load_history" action', async () => {
@@ -819,15 +818,15 @@ describe('useSlashCommandProcessor', () => {
mockClearItems,
mockLoadHistory,
vi.fn(), // refreshStatic
mockSetShowHelp,
vi.fn(), // onDebugMessage
vi.fn(), // openThemeDialog
mockOpenAuthDialog,
vi.fn(), // openEditorDialog,
vi.fn(), // openEditorDialog
vi.fn(), // toggleCorgiMode
mockSetQuittingMessages,
vi.fn(), // openPrivacyNotice
vi.fn(), // toggleVimEnabled
vi.fn().mockResolvedValue(false), // toggleVimEnabled
vi.fn(), // setIsProcessing
),
);