mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-22 15:51:18 -07:00
Migrate core render util to use xterm.js as part of the rendering loop. (#19044)
This commit is contained in:
@@ -66,46 +66,52 @@ describe('Focus Hint', () => {
|
||||
|
||||
describe.each(testCases)('$componentName', ({ Component }) => {
|
||||
it('shows focus hint after delay even with NO output', async () => {
|
||||
const { lastFrame } = renderWithProviders(
|
||||
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
|
||||
<Component {...baseProps} resultDisplay={undefined} />,
|
||||
{ uiState: { streamingState: StreamingState.Idle } },
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
// Initially, no focus hint
|
||||
expect(lastFrame()).toMatchSnapshot('initial-no-output');
|
||||
|
||||
// Advance timers by the delay
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
vi.advanceTimersByTime(SHELL_FOCUS_HINT_DELAY_MS + 100);
|
||||
});
|
||||
await waitUntilReady();
|
||||
|
||||
// Now it SHOULD contain the focus hint
|
||||
expect(lastFrame()).toMatchSnapshot('after-delay-no-output');
|
||||
expect(lastFrame()).toContain('(Tab to focus)');
|
||||
unmount();
|
||||
});
|
||||
|
||||
it('shows focus hint after delay with output', async () => {
|
||||
const { lastFrame } = renderWithProviders(
|
||||
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
|
||||
<Component {...baseProps} resultDisplay="Some output" />,
|
||||
{ uiState: { streamingState: StreamingState.Idle } },
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
// Initially, no focus hint
|
||||
expect(lastFrame()).toMatchSnapshot('initial-with-output');
|
||||
|
||||
// Advance timers
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
vi.advanceTimersByTime(SHELL_FOCUS_HINT_DELAY_MS + 100);
|
||||
});
|
||||
await waitUntilReady();
|
||||
|
||||
expect(lastFrame()).toMatchSnapshot('after-delay-with-output');
|
||||
expect(lastFrame()).toContain('(Tab to focus)');
|
||||
unmount();
|
||||
});
|
||||
});
|
||||
|
||||
it('handles long descriptions by shrinking them to show the focus hint', async () => {
|
||||
const longDescription = 'A'.repeat(100);
|
||||
const { lastFrame } = renderWithProviders(
|
||||
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
|
||||
<ToolMessage
|
||||
{...baseProps}
|
||||
description={longDescription}
|
||||
@@ -113,15 +119,18 @@ describe('Focus Hint', () => {
|
||||
/>,
|
||||
{ uiState: { streamingState: StreamingState.Idle } },
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
vi.advanceTimersByTime(SHELL_FOCUS_HINT_DELAY_MS + 100);
|
||||
});
|
||||
await waitUntilReady();
|
||||
|
||||
// The focus hint should be visible
|
||||
expect(lastFrame()).toMatchSnapshot('long-description');
|
||||
expect(lastFrame()).toContain('(Tab to focus)');
|
||||
// The name should still be visible
|
||||
expect(lastFrame()).toContain(SHELL_COMMAND_NAME);
|
||||
unmount();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user