fix(cli): fix history navigation regression after prompt autocomplete (#18752)

This commit is contained in:
Sehoon Shon
2026-02-10 15:53:06 -05:00
committed by GitHub
parent 2eb1c92347
commit ea1f19aa52
2 changed files with 27 additions and 30 deletions

View File

@@ -281,7 +281,10 @@ describe('InputPrompt', () => {
navigateDown: vi.fn(),
handleSubmit: vi.fn(),
};
mockedUseInputHistory.mockReturnValue(mockInputHistory);
mockedUseInputHistory.mockImplementation(({ onSubmit }) => {
mockInputHistory.handleSubmit = vi.fn((val) => onSubmit(val));
return mockInputHistory;
});
mockReverseSearchCompletion = {
suggestions: [],
@@ -4093,7 +4096,7 @@ describe('InputPrompt', () => {
beforeEach(() => {
props.userMessages = ['first message', 'second message'];
// Mock useInputHistory to actually call onChange
mockedUseInputHistory.mockImplementation(({ onChange }) => ({
mockedUseInputHistory.mockImplementation(({ onChange, onSubmit }) => ({
navigateUp: () => {
onChange('second message', 'start');
return true;
@@ -4102,7 +4105,7 @@ describe('InputPrompt', () => {
onChange('first message', 'end');
return true;
},
handleSubmit: vi.fn(),
handleSubmit: vi.fn((val) => onSubmit(val)),
}));
});