feat: add overlay click-away handler for sidebar on narrow screens

This commit is contained in:
Brian Krabach
2026-03-27 17:49:07 -07:00
parent cf6f7daf45
commit b62bd3e361
2 changed files with 48 additions and 0 deletions
+23
View File
@@ -2001,3 +2001,26 @@ test('bindStaticEventListeners binds sidebar-toggle-btn and sidebar-collapse-btn
globalThis.document.getElementById = origGetById;
globalThis.document.addEventListener = origDocAddListener;
});
// --- bindSidebarClickAway ---
test('bindSidebarClickAway is exported and callable', () => {
assert.strictEqual(typeof app.bindSidebarClickAway, 'function', 'bindSidebarClickAway should be a function');
});
test('bindSidebarClickAway registers click listener on terminal-container', () => {
let addEventListenerCalledWith = null;
const mockTerminalContainer = {
addEventListener: (ev, fn) => { addEventListenerCalledWith = ev; },
};
const origGetById = globalThis.document.getElementById;
globalThis.document.getElementById = (id) => {
if (id === 'terminal-container') return mockTerminalContainer;
return null;
};
app.bindSidebarClickAway();
assert.strictEqual(addEventListenerCalledWith, 'click', 'bindSidebarClickAway should register a click listener on terminal-container');
globalThis.document.getElementById = origGetById;
});