fix(cli): ctrl c/ctrl d close cli when in dialogs (#8685)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
Co-authored-by: matt korwel <matt.korwel@gmail.com>
This commit is contained in:
fuyou
2025-09-19 14:52:29 +08:00
committed by GitHub
parent 938c850ed8
commit e48f61bdc7
4 changed files with 231 additions and 25 deletions
+32
View File
@@ -83,4 +83,36 @@ describe('App', () => {
expect(lastFrame()).toContain('Notifications');
expect(lastFrame()).toContain('DialogManager');
});
it('should show Ctrl+C exit prompt when dialogs are visible and ctrlCPressedOnce is true', () => {
const ctrlCUIState = {
...mockUIState,
dialogsVisible: true,
ctrlCPressedOnce: true,
} as UIState;
const { lastFrame } = render(
<UIStateContext.Provider value={ctrlCUIState}>
<App />
</UIStateContext.Provider>,
);
expect(lastFrame()).toContain('Press Ctrl+C again to exit.');
});
it('should show Ctrl+D exit prompt when dialogs are visible and ctrlDPressedOnce is true', () => {
const ctrlDUIState = {
...mockUIState,
dialogsVisible: true,
ctrlDPressedOnce: true,
} as UIState;
const { lastFrame } = render(
<UIStateContext.Provider value={ctrlDUIState}>
<App />
</UIStateContext.Provider>,
);
expect(lastFrame()).toContain('Press Ctrl+D again to exit.');
});
});