@@ -11,6 +11,7 @@ import { StatusDisplay } from './StatusDisplay.js';
1111import { UIStateContext , type UIState } from '../contexts/UIStateContext.js' ;
1212import { ConfigContext } from '../contexts/ConfigContext.js' ;
1313import { SettingsContext } from '../contexts/SettingsContext.js' ;
14+ import type { TextBuffer } from './shared/text-buffer.js' ;
1415
1516// Mock child components to simplify testing
1617vi . mock ( './ContextSummaryDisplay.js' , ( ) => ( {
@@ -23,8 +24,13 @@ vi.mock('./HookStatusDisplay.js', () => ({
2324 HookStatusDisplay : ( ) => < Text > Mock Hook Status Display</ Text > ,
2425} ) ) ;
2526
27+ // Use a type that allows partial buffer for mocking purposes
28+ type UIStateOverrides = Partial < Omit < UIState , 'buffer' > > & {
29+ buffer ?: Partial < TextBuffer > ;
30+ } ;
31+
2632// Create mock context providers
27- const createMockUIState = ( overrides : Partial < UIState > = { } ) : UIState =>
33+ const createMockUIState = ( overrides : UIStateOverrides = { } ) : UIState =>
2834 ( {
2935 ctrlCPressedOnce : false ,
3036 warningMessage : null ,
@@ -35,6 +41,8 @@ const createMockUIState = (overrides: Partial<UIState> = {}): UIState =>
3541 ideContextState : null ,
3642 geminiMdFileCount : 0 ,
3743 contextFileNames : [ ] ,
44+ buffer : { text : '' } ,
45+ history : [ { id : 1 , type : 'user' , text : 'test' } ] ,
3846 ...overrides ,
3947 } ) as UIState ;
4048
@@ -147,9 +155,22 @@ describe('StatusDisplay', () => {
147155 expect ( lastFrame ( ) ) . toMatchSnapshot ( ) ;
148156 } ) ;
149157
150- it ( 'renders Escape prompt' , ( ) => {
158+ it ( 'renders Escape prompt when buffer is empty' , ( ) => {
159+ const uiState = createMockUIState ( {
160+ showEscapePrompt : true ,
161+ buffer : { text : '' } ,
162+ } ) ;
163+ const { lastFrame } = renderStatusDisplay (
164+ { hideContextSummary : false } ,
165+ uiState ,
166+ ) ;
167+ expect ( lastFrame ( ) ) . toMatchSnapshot ( ) ;
168+ } ) ;
169+
170+ it ( 'renders Escape prompt when buffer is NOT empty' , ( ) => {
151171 const uiState = createMockUIState ( {
152172 showEscapePrompt : true ,
173+ buffer : { text : 'some text' } ,
153174 } ) ;
154175 const { lastFrame } = renderStatusDisplay (
155176 { hideContextSummary : false } ,
0 commit comments