mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 10:34:35 -07:00
fix: expand paste placeholders in TextInput on submit (#19946)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1347,4 +1347,47 @@ describe('AskUserDialog', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('expands paste placeholders in multi-select custom option via Done', async () => {
|
||||
const questions: Question[] = [
|
||||
{
|
||||
question: 'Which features?',
|
||||
header: 'Features',
|
||||
type: QuestionType.CHOICE,
|
||||
options: [{ label: 'TypeScript', description: '' }],
|
||||
multiSelect: true,
|
||||
},
|
||||
];
|
||||
|
||||
const onSubmit = vi.fn();
|
||||
const { stdin } = renderWithProviders(
|
||||
<AskUserDialog
|
||||
questions={questions}
|
||||
onSubmit={onSubmit}
|
||||
onCancel={vi.fn()}
|
||||
width={120}
|
||||
/>,
|
||||
{ width: 120 },
|
||||
);
|
||||
|
||||
// Select TypeScript
|
||||
writeKey(stdin, '\r');
|
||||
// Down to Other
|
||||
writeKey(stdin, '\x1b[B');
|
||||
|
||||
// Simulate bracketed paste of multi-line text into the custom option
|
||||
const pastedText = 'Line 1\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6';
|
||||
const ESC = '\x1b';
|
||||
writeKey(stdin, `${ESC}[200~${pastedText}${ESC}[201~`);
|
||||
|
||||
// Down to Done and submit
|
||||
writeKey(stdin, '\x1b[B');
|
||||
writeKey(stdin, '\r');
|
||||
|
||||
await waitFor(() => {
|
||||
expect(onSubmit).toHaveBeenCalledWith({
|
||||
'0': `TypeScript, ${pastedText}`,
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user