mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-12 04:17:15 -07:00
feat(ui): added microphone and updated placeholder for voice mode (#26270)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -4979,9 +4979,10 @@ describe('InputPrompt', () => {
|
||||
);
|
||||
|
||||
// Initially not recording
|
||||
expect(lastFrame()).not.toContain('🎙️ Listening...');
|
||||
expect(lastFrame()).not.toContain('Listening...');
|
||||
expect(lastFrame()).toContain('🎤 >');
|
||||
expect(lastFrame()).toContain(
|
||||
'Voice mode: Space to start/stop recording',
|
||||
'Type your message or space to talk (Esc to exit)',
|
||||
);
|
||||
|
||||
// Press space to start
|
||||
@@ -4991,7 +4992,7 @@ describe('InputPrompt', () => {
|
||||
|
||||
// Now should show listening
|
||||
await waitFor(() => {
|
||||
expect(lastFrame()).toContain('🎙️ Listening...');
|
||||
expect(lastFrame()).toContain('Listening...');
|
||||
});
|
||||
|
||||
unmount();
|
||||
@@ -5016,7 +5017,7 @@ describe('InputPrompt', () => {
|
||||
stdin.write(' ');
|
||||
});
|
||||
await waitFor(() => {
|
||||
expect(lastFrame()).toContain('🎙️ Listening...');
|
||||
expect(lastFrame()).toContain('Listening...');
|
||||
});
|
||||
|
||||
// Stop recording
|
||||
@@ -5024,10 +5025,8 @@ describe('InputPrompt', () => {
|
||||
stdin.write(' ');
|
||||
});
|
||||
await waitFor(() => {
|
||||
expect(lastFrame()).not.toContain('🎙️ Listening...');
|
||||
expect(lastFrame()).toContain(
|
||||
'Voice mode: Space to start/stop recording',
|
||||
);
|
||||
expect(lastFrame()).not.toContain('Listening...');
|
||||
expect(lastFrame()).toContain('🎤 >');
|
||||
});
|
||||
|
||||
unmount();
|
||||
@@ -5047,10 +5046,8 @@ describe('InputPrompt', () => {
|
||||
},
|
||||
);
|
||||
|
||||
// Should show voice mode hint even if buffer is not empty (new behavior)
|
||||
expect(lastFrame()).toContain(
|
||||
'Voice mode: Space to start/stop recording',
|
||||
);
|
||||
// Should show voice mode prefix even if buffer is not empty
|
||||
expect(lastFrame()).toContain('🎤 >');
|
||||
expect(lastFrame()).toContain('some existing text');
|
||||
|
||||
// Press space to start recording again
|
||||
@@ -5059,7 +5056,7 @@ describe('InputPrompt', () => {
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
expect(lastFrame()).toContain('🎙️ Listening...');
|
||||
expect(lastFrame()).toContain('Listening...');
|
||||
});
|
||||
|
||||
unmount();
|
||||
@@ -5085,7 +5082,7 @@ describe('InputPrompt', () => {
|
||||
});
|
||||
|
||||
// Should NOT show listening, instead should call handleInput which handles space
|
||||
expect(lastFrame()).not.toContain('🎙️ Listening...');
|
||||
expect(lastFrame()).not.toContain('Listening...');
|
||||
expect(mockBuffer.handleInput).toHaveBeenCalled();
|
||||
unmount();
|
||||
});
|
||||
@@ -5202,7 +5199,10 @@ describe('InputPrompt', () => {
|
||||
},
|
||||
);
|
||||
|
||||
expect(lastFrame()).toContain('Voice mode: Hold Space to record');
|
||||
expect(lastFrame()).toContain('🎤 >');
|
||||
expect(lastFrame()).toContain(
|
||||
'Type your message or hold space to talk (Esc to exit)',
|
||||
);
|
||||
|
||||
// Press space once
|
||||
await act(async () => {
|
||||
@@ -5211,14 +5211,14 @@ describe('InputPrompt', () => {
|
||||
|
||||
// Should insert space optimistically
|
||||
expect(mockBuffer.insert).toHaveBeenCalledWith(' ');
|
||||
expect(lastFrame()).not.toContain('🎙️ Listening...');
|
||||
expect(lastFrame()).not.toContain('Listening...');
|
||||
|
||||
// Advance timer past HOLD_DELAY_MS
|
||||
await act(async () => {
|
||||
vi.advanceTimersByTime(700);
|
||||
});
|
||||
|
||||
expect(lastFrame()).not.toContain('🎙️ Listening...');
|
||||
expect(lastFrame()).not.toContain('Listening...');
|
||||
unmount();
|
||||
});
|
||||
|
||||
@@ -5248,7 +5248,7 @@ describe('InputPrompt', () => {
|
||||
// Should have backspaced the optimistic space
|
||||
expect(mockBuffer.backspace).toHaveBeenCalled();
|
||||
// Should show listening
|
||||
expect(lastFrame()).toContain('🎙️ Listening...');
|
||||
expect(lastFrame()).toContain('Listening...');
|
||||
});
|
||||
|
||||
unmount();
|
||||
@@ -5274,7 +5274,7 @@ describe('InputPrompt', () => {
|
||||
// Use a short interval in waitFor to prevent advancing fake timers past the 300ms RELEASE_DELAY_MS
|
||||
await waitFor(
|
||||
() => {
|
||||
expect(lastFrame()).toContain('🎙️ Listening...');
|
||||
expect(lastFrame()).toContain('Listening...');
|
||||
},
|
||||
{ interval: 10 },
|
||||
);
|
||||
@@ -5284,7 +5284,8 @@ describe('InputPrompt', () => {
|
||||
stdin.write(' ');
|
||||
vi.advanceTimersByTime(100);
|
||||
});
|
||||
expect(lastFrame()).toContain('🎙️ Listening...');
|
||||
expect(lastFrame()).toContain('🎤 >');
|
||||
expect(lastFrame()).toContain('Listening...');
|
||||
|
||||
// Stop heartbeat (release)
|
||||
await act(async () => {
|
||||
@@ -5292,7 +5293,7 @@ describe('InputPrompt', () => {
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
expect(lastFrame()).not.toContain('🎙️ Listening...');
|
||||
expect(lastFrame()).not.toContain('Listening...');
|
||||
});
|
||||
|
||||
unmount();
|
||||
|
||||
Reference in New Issue
Block a user