mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-26 04:54:25 -07:00
Support ink scrolling final pr (#12567)
This commit is contained in:
@@ -12,6 +12,7 @@ import { App } from './App.js';
|
||||
import { UIStateContext, type UIState } from './contexts/UIStateContext.js';
|
||||
import { StreamingState } from './types.js';
|
||||
import { ConfigContext } from './contexts/ConfigContext.js';
|
||||
import { AppContext, type AppState } from './contexts/AppContext.js';
|
||||
import { SettingsContext } from './contexts/SettingsContext.js';
|
||||
import {
|
||||
type SettingScope,
|
||||
@@ -47,6 +48,10 @@ vi.mock('./components/QuittingDisplay.js', () => ({
|
||||
QuittingDisplay: () => <Text>Quitting...</Text>,
|
||||
}));
|
||||
|
||||
vi.mock('./components/HistoryItemDisplay.js', () => ({
|
||||
HistoryItemDisplay: () => <Text>HistoryItemDisplay</Text>,
|
||||
}));
|
||||
|
||||
vi.mock('./components/Footer.js', () => ({
|
||||
Footer: () => <Text>Footer</Text>,
|
||||
}));
|
||||
@@ -65,6 +70,8 @@ describe('App', () => {
|
||||
clearItems: vi.fn(),
|
||||
loadHistory: vi.fn(),
|
||||
},
|
||||
history: [],
|
||||
pendingHistoryItems: [],
|
||||
};
|
||||
|
||||
const mockConfig = makeFakeConfig();
|
||||
@@ -84,13 +91,22 @@ describe('App', () => {
|
||||
new Set<SettingScope>(),
|
||||
);
|
||||
|
||||
const mockAppState: AppState = {
|
||||
version: '1.0.0',
|
||||
startupWarnings: [],
|
||||
};
|
||||
|
||||
const renderWithProviders = (ui: React.ReactElement, state: UIState) =>
|
||||
render(
|
||||
<ConfigContext.Provider value={mockConfig}>
|
||||
<SettingsContext.Provider value={mockLoadedSettings}>
|
||||
<UIStateContext.Provider value={state}>{ui}</UIStateContext.Provider>
|
||||
</SettingsContext.Provider>
|
||||
</ConfigContext.Provider>,
|
||||
<AppContext.Provider value={mockAppState}>
|
||||
<ConfigContext.Provider value={mockConfig}>
|
||||
<SettingsContext.Provider value={mockLoadedSettings}>
|
||||
<UIStateContext.Provider value={state}>
|
||||
{ui}
|
||||
</UIStateContext.Provider>
|
||||
</SettingsContext.Provider>
|
||||
</ConfigContext.Provider>
|
||||
</AppContext.Provider>,
|
||||
);
|
||||
|
||||
it('should render main content and composer when not quitting', () => {
|
||||
@@ -112,6 +128,25 @@ describe('App', () => {
|
||||
expect(lastFrame()).toContain('Quitting...');
|
||||
});
|
||||
|
||||
it('should render full history in alternate buffer mode when quittingMessages is set', () => {
|
||||
const quittingUIState = {
|
||||
...mockUIState,
|
||||
quittingMessages: [{ id: 1, type: 'user', text: 'test' }],
|
||||
history: [{ id: 1, type: 'user', text: 'history item' }],
|
||||
pendingHistoryItems: [{ type: 'user', text: 'pending item' }],
|
||||
} as UIState;
|
||||
|
||||
mockLoadedSettings.merged.ui = { useAlternateBuffer: true };
|
||||
|
||||
const { lastFrame } = renderWithProviders(<App />, quittingUIState);
|
||||
|
||||
expect(lastFrame()).toContain('HistoryItemDisplay');
|
||||
expect(lastFrame()).toContain('Quitting...');
|
||||
|
||||
// Reset settings
|
||||
mockLoadedSettings.merged.ui = { useAlternateBuffer: false };
|
||||
});
|
||||
|
||||
it('should render dialog manager when dialogs are visible', () => {
|
||||
const dialogUIState = {
|
||||
...mockUIState,
|
||||
|
||||
Reference in New Issue
Block a user