mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-20 18:14:29 -07:00
split context (#24623)
This commit is contained in:
@@ -5,8 +5,11 @@
|
||||
*/
|
||||
|
||||
import { render } from '../../test-utils/render.js';
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { DefaultAppLayout } from './DefaultAppLayout.js';
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { useInputState } from '../contexts/InputContext.js';
|
||||
|
||||
vi.mock('../contexts/InputContext.js');
|
||||
import { StreamingState } from '../types.js';
|
||||
import { Text } from 'ink';
|
||||
import type { UIState } from '../contexts/UIStateContext.js';
|
||||
@@ -95,6 +98,9 @@ const createMockShell = (pid: number): BackgroundTask => ({
|
||||
describe('<DefaultAppLayout />', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
vi.mocked(useInputState).mockReturnValue({
|
||||
copyModeEnabled: false,
|
||||
} as unknown as ReturnType<typeof useInputState>);
|
||||
// Reset mock state defaults
|
||||
mockUIState.backgroundTasks = new Map();
|
||||
mockUIState.activeBackgroundTaskPid = null;
|
||||
|
||||
@@ -17,9 +17,11 @@ import { useAlternateBuffer } from '../hooks/useAlternateBuffer.js';
|
||||
import { CopyModeWarning } from '../components/CopyModeWarning.js';
|
||||
import { BackgroundTaskDisplay } from '../components/BackgroundTaskDisplay.js';
|
||||
import { StreamingState } from '../types.js';
|
||||
import { useInputState } from '../contexts/InputContext.js';
|
||||
|
||||
export const DefaultAppLayout: React.FC = () => {
|
||||
const uiState = useUIState();
|
||||
const { copyModeEnabled } = useInputState();
|
||||
const isAlternateBuffer = useAlternateBuffer();
|
||||
|
||||
const { rootUiRef, terminalHeight } = uiState;
|
||||
@@ -62,9 +64,7 @@ export const DefaultAppLayout: React.FC = () => {
|
||||
flexShrink={0}
|
||||
flexGrow={0}
|
||||
width={uiState.terminalWidth}
|
||||
height={
|
||||
uiState.copyModeEnabled ? uiState.stableControlsHeight : undefined
|
||||
}
|
||||
height={copyModeEnabled ? uiState.stableControlsHeight : undefined}
|
||||
>
|
||||
<Notifications />
|
||||
<CopyModeWarning />
|
||||
|
||||
Reference in New Issue
Block a user