mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 15:41:17 +00:00
useThemeRuntime now returns a memoized bag with setters-stable callbacks, and App domain memos depend on clear/pick/resolve members instead of the whole runtime object so unrelated App re-renders no longer rebuild appTerminalDomain.
23 lines
1.5 KiB
TypeScript
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=\{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/);
|
|
});
|