mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-10 09:19:42 +02:00
fix: COD-153 guard command palette escape close
This commit is contained in:
committed by
Aamer Akhter
parent
c45e456b0e
commit
3d4444ad78
@@ -2368,6 +2368,10 @@ Object.assign(CodemanApp.prototype, {
|
|||||||
this.closeAppSettings();
|
this.closeAppSettings();
|
||||||
this.cancelCloseSession();
|
this.cancelCloseSession();
|
||||||
this.closeTokenStats();
|
this.closeTokenStats();
|
||||||
|
// Mobile header utility tray closes alongside the other overlays so Escape
|
||||||
|
// (and any future closeAllPanels caller) dismisses it like every other panel
|
||||||
|
// instead of leaving it pinned open with only its toggle to close it.
|
||||||
|
this.closeMobileHeaderUtilities?.();
|
||||||
document.getElementById('monitorPanel').classList.remove('open');
|
document.getElementById('monitorPanel').classList.remove('open');
|
||||||
// Collapse subagents panel (don't hide it permanently)
|
// Collapse subagents panel (don't hide it permanently)
|
||||||
const subagentsPanel = document.getElementById('subagentsPanel');
|
const subagentsPanel = document.getElementById('subagentsPanel');
|
||||||
|
|||||||
@@ -213,3 +213,33 @@ describe('Command-K session palette', () => {
|
|||||||
expect(app.selectSession).toHaveBeenCalledWith('sess-alpha');
|
expect(app.selectSession).toHaveBeenCalledWith('sess-alpha');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('panel close helpers', () => {
|
||||||
|
it('closes panels when the mobile header helper is unavailable', () => {
|
||||||
|
const CodemanApp = function CodemanApp(this: any) {};
|
||||||
|
const elements: Record<string, any> = {
|
||||||
|
monitorPanel: { classList: { remove: vi.fn() } },
|
||||||
|
subagentsPanel: { classList: { remove: vi.fn() } },
|
||||||
|
};
|
||||||
|
const context = vm.createContext({
|
||||||
|
CodemanApp,
|
||||||
|
document: {
|
||||||
|
getElementById: (id: string) => elements[id] ?? null,
|
||||||
|
},
|
||||||
|
console,
|
||||||
|
});
|
||||||
|
|
||||||
|
const settingsUi = readFileSync(resolve(import.meta.dirname, '../src/web/public/settings-ui.js'), 'utf8');
|
||||||
|
vm.runInContext(settingsUi, context, { filename: 'settings-ui.js' });
|
||||||
|
|
||||||
|
const app = new (CodemanApp as any)();
|
||||||
|
app.closeSessionOptions = vi.fn();
|
||||||
|
app.closeAppSettings = vi.fn();
|
||||||
|
app.cancelCloseSession = vi.fn();
|
||||||
|
app.closeTokenStats = vi.fn();
|
||||||
|
|
||||||
|
expect(() => app.closeAllPanels()).not.toThrow();
|
||||||
|
expect(elements.monitorPanel.classList.remove).toHaveBeenCalledWith('open');
|
||||||
|
expect(elements.subagentsPanel.classList.remove).toHaveBeenCalledWith('open');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user