Files
Netcatty/application/state/useManualTerminalChromeSurfaceInjection.test.ts
T
bincxz 71687491f0 Fix terminal theme mode switching and speed up workspace tab changes.
Keep connection dialog and chrome surfaces in sync when toggling follow-app vs manual themes, and isolate side-panel live state per tab so switching workspace tabs no longer re-renders every mounted panel.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 03:28:50 +08:00

23 lines
1.5 KiB
TypeScript

import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import test from 'node:test';
const appSource = readFileSync(new URL('../../App.tsx', import.meta.url), 'utf8');
const hookSource = readFileSync(new URL('./useManualTerminalChromeSurfaceInjection.ts', import.meta.url), 'utf8');
const bridgeSource = readFileSync(new URL('../../components/terminalLayer/TerminalLayerTabBridge.tsx', import.meta.url), 'utf8');
const varsSource = readFileSync(new URL('../../infrastructure/theme/terminalAppearanceVars.ts', import.meta.url), 'utf8');
test('manual mode injects chrome surfaces from focused session theme', () => {
assert.match(appSource, /includeChromeSurfaces: followAppTerminalTheme/);
assert.match(bridgeSource, /useManualTerminalChromeSurfaceInjection/);
assert.match(bridgeSource, /!s\.followAppTerminalTheme && isTerminalLayerVisible/);
assert.match(readFileSync(new URL('../app/AppHostTreeLayer.tsx', import.meta.url), 'utf8'), /useManualTerminalChromeSurfaceInjection/);
assert.match(appSource, /resolveSessionAppearance=\{themeRuntime\.resolveFocusedAppearance\}/);
assert.match(hookSource, /applyTopTabsChromeThemeVars\(theme\)/);
assert.match(hookSource, /injectTerminalLayerChromeSurfaceVars\(theme\)/);
assert.match(hookSource, /if \(wasEnabled\) \{[\s\S]*clearTerminalLayerChromeSurfaceVars\(\)/);
assert.doesNotMatch(hookSource, /clearTopTabsChromeThemeVars\(\)/);
assert.match(varsSource, /injectTerminalLayerChromeSurfaceVars/);
assert.match(varsSource, /clearTerminalLayerChromeSurfaceVars/);
});