Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
91 lines
4.2 KiB
TypeScript
91 lines
4.2 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import test from "node:test";
|
|
|
|
const terminalSource = readFileSync(new URL("../Terminal.tsx", import.meta.url), "utf8");
|
|
const effectsSource = readFileSync(new URL("./useTerminalEffects.ts", import.meta.url), "utf8");
|
|
const supportSource = readFileSync(new URL("../terminalLayer/TerminalLayerSupport.tsx", import.meta.url), "utf8");
|
|
const viewSource = readFileSync(new URL("../terminalLayer/TerminalLayerView.tsx", import.meta.url), "utf8");
|
|
const tabBridgeSource = readFileSync(new URL("../terminalLayer/TerminalLayerTabBridge.tsx", import.meta.url), "utf8");
|
|
const workspaceLayoutSource = readFileSync(new URL("../terminalLayer/useTerminalWorkspaceLayout.ts", import.meta.url), "utf8");
|
|
const layerEffectsSource = readFileSync(new URL("../terminalLayer/useTerminalLayerEffects.ts", import.meta.url), "utf8");
|
|
|
|
test("renderer activity follows the hibernate setting instead of active-tab visibility", () => {
|
|
assert.match(
|
|
terminalSource,
|
|
/const isRendererActive = isVisible \|\| !hibernateEnabled/,
|
|
);
|
|
assert.match(terminalSource, /isPaneVisibleRef: isVisibleRef/);
|
|
assert.match(terminalSource, /isVisibleRef: isRendererActiveRef/);
|
|
assert.match(terminalSource, /if \(!isRendererActiveRef\.current && !options\?\.allowHidden\)/);
|
|
assert.match(
|
|
effectsSource,
|
|
/const isRendererActive = isVisible \|\| !hibernateHiddenTabs;[\s\S]*const isRendererActiveRef = useRef\(isRendererActive\)/,
|
|
);
|
|
});
|
|
|
|
test("inactive terminal surfaces remain mounted and non-interactive without hibernate", () => {
|
|
assert.match(supportSource, /resolveTerminalHibernateEnabledForProtocol\(terminalSettings, host\.protocol\)/);
|
|
assert.match(
|
|
supportSource,
|
|
/inert=\{isVisible && !isCoveredByMagnification \? undefined : true\}/,
|
|
);
|
|
assert.match(viewSource, /ctx\.hibernateHiddenTabs/);
|
|
assert.match(viewSource, /inert=\{ctx\.isTerminalLayerVisible \? undefined : true\}/);
|
|
});
|
|
|
|
test("background split workspaces keep their live geometry without hibernate", () => {
|
|
assert.match(
|
|
tabBridgeSource,
|
|
/shouldKeepHiddenWorkspaceLaidOut/,
|
|
);
|
|
assert.match(
|
|
workspaceLayoutSource,
|
|
/if \(shouldKeepHiddenWorkspaceLaidOut\(workspace\)\) \{[\s\S]*cachedSizeIsUsable[\s\S]*computeWorkspaceRects\(layoutWorkspace, layoutSize\)/,
|
|
);
|
|
assert.match(
|
|
supportSource,
|
|
/const layoutWorkspaceId = activeWorkspaceId \?\? \(!hibernateHiddenTabs \? session\.workspaceId : undefined\)/,
|
|
);
|
|
assert.match(supportSource, /inWorkspace=\{keepsWorkspacePresentation\}/);
|
|
assert.match(
|
|
supportSource,
|
|
/isWorkspaceComposeBarOpen=\{inActiveWorkspace \? isComposeBarOpen : undefined\}/,
|
|
);
|
|
assert.match(
|
|
supportSource,
|
|
/shouldUseTerminalPaneSplitLayout\(\{[\s\S]*workspace: layoutWorkspace,[\s\S]*sessionId: session\.id,[\s\S]*isVisible,[\s\S]*hibernateHiddenTabs/,
|
|
);
|
|
assert.match(
|
|
supportSource,
|
|
/const initializeHiddenFullSize = !hibernateHiddenTabs[\s\S]*&& !rect[\s\S]*&& !lastVisiblePaneSizeRef\.current;[\s\S]*bumpHiddenPaneSizeVersion/,
|
|
);
|
|
// Split rects must never feed the hidden-pane pinned size, or a
|
|
// split -> focus viewMode switch pins hidden panes (and their PTYs) at the
|
|
// cached fragment width (#3046).
|
|
assert.match(
|
|
supportSource,
|
|
/if \(isVisible && !rect\) \{[\s\S]*const observer = new ResizeObserver\(\(\) => \{[\s\S]*capturePaneSize\(\)/,
|
|
);
|
|
// A split-visible pane must drop the cached full-size measurement so a later
|
|
// hidden full-size layout re-measures the current area instead of pinning
|
|
// stale pixels (#3046).
|
|
assert.match(
|
|
supportSource,
|
|
/if \(isVisible\) \{[\s\S]{0,400}lastVisiblePaneSizeRef\.current = null;[\s\S]{0,20}return;/,
|
|
);
|
|
assert.match(
|
|
layerEffectsSource,
|
|
/if \(!shouldMeasureTerminalLayerLayout\) return;[\s\S]*?remeasureWorkspaceArea\(\)/,
|
|
);
|
|
assert.match(
|
|
tabBridgeSource,
|
|
/const keepHiddenLayoutActive = !hibernateHiddenTabs \|\| localWorkspaceIds\.size > 0/,
|
|
);
|
|
assert.match(
|
|
tabBridgeSource,
|
|
/shouldMeasureTerminalLayerLayout: shouldMeasureTerminalLayerLayout\(\{[\s\S]*keepHiddenLayoutActive,[\s\S]*workspaceArea/,
|
|
);
|
|
assert.doesNotMatch(tabBridgeSource, /isTerminalLayerRendererActive/);
|
|
});
|