mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
037b85bd66
Replace immersive instant-switch with animated active chrome theme sync so top tabs match terminal sessions immediately on tab click, and clamp autocomplete popups to the active pane so they stay anchored to the cursor in split workspaces. Co-authored-by: Cursor <cursoragent@cursor.com>
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
|
|
const storage = new Map<string, string>();
|
|
Object.defineProperty(globalThis, 'localStorage', {
|
|
configurable: true,
|
|
value: {
|
|
getItem: (key: string) => storage.get(key) ?? null,
|
|
setItem: (key: string, value: string) => storage.set(key, value),
|
|
removeItem: (key: string) => storage.delete(key),
|
|
},
|
|
});
|
|
|
|
const {
|
|
TERMINAL_HOST_TREE_DEFAULT_WIDTH,
|
|
clampTerminalHostTreeWidth,
|
|
terminalHostTreeStore,
|
|
} = await import('./terminalHostTreeStore.ts');
|
|
|
|
test('closing host tree state does not mutate layout width by itself', () => {
|
|
terminalHostTreeStore.setIsOpen(true);
|
|
terminalHostTreeStore.setLayoutWidth(240);
|
|
|
|
terminalHostTreeStore.setIsOpen(false);
|
|
|
|
assert.equal(terminalHostTreeStore.getLayoutWidth(), 240);
|
|
terminalHostTreeStore.setLayoutWidth(0);
|
|
});
|
|
|
|
test('opening host tree state does not jump the layout width', () => {
|
|
storage.set('netcatty_terminal_host_tree_width_v1', '300');
|
|
terminalHostTreeStore.setLayoutWidth(0);
|
|
terminalHostTreeStore.setIsOpen(false);
|
|
|
|
terminalHostTreeStore.setIsOpen(true);
|
|
|
|
assert.equal(terminalHostTreeStore.getLayoutWidth(), 0);
|
|
terminalHostTreeStore.setLayoutWidth(0);
|
|
});
|
|
|
|
test('host tree restored layout width is clamped', () => {
|
|
assert.equal(clampTerminalHostTreeWidth(80), 160);
|
|
assert.equal(clampTerminalHostTreeWidth(999), 360);
|
|
assert.equal(clampTerminalHostTreeWidth(0), 160);
|
|
assert.equal(TERMINAL_HOST_TREE_DEFAULT_WIDTH, 220);
|
|
});
|