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
35 lines
1.8 KiB
TypeScript
35 lines
1.8 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
import { readFileSync } from "node:fs";
|
|
|
|
const source = readFileSync(new URL("./activeChromeThemeSync.ts", import.meta.url), "utf8");
|
|
const chromeThemeSource = readFileSync(new URL("./useActiveChromeTheme.ts", import.meta.url), "utf8");
|
|
const storeSource = readFileSync(new URL("./activeTabStore.ts", import.meta.url), "utf8");
|
|
|
|
test("active tab changes notify chrome theme before react subscribers", () => {
|
|
const setActiveTabIdBody = storeSource.match(/setActiveTabId = \(id: string(?:, options\?: \w+)?\) => \{[\s\S]*?\n {2}\};/)?.[0] ?? "";
|
|
assert.match(setActiveTabIdBody, /this\.syncListeners\.forEach\(\(listener\) => listener\(id\)\)/);
|
|
assert.match(setActiveTabIdBody, /this\.scheduleNotify\(\)/);
|
|
assert.ok(
|
|
setActiveTabIdBody.indexOf("syncListeners.forEach") < setActiveTabIdBody.indexOf("scheduleNotify"),
|
|
"sync chrome theme listeners must run before deferred react notify",
|
|
);
|
|
assert.match(source, /activeTabStore\.subscribeSync\(notifyActiveChromeThemeForTab\)/);
|
|
assert.match(source, /isActiveChromeThemeResolvable/);
|
|
assert.match(source, /clearTopTabsChromeThemeVars/);
|
|
});
|
|
|
|
test("tab chrome notify defers apply via rAF and short-circuits on fingerprint", () => {
|
|
assert.match(source, /requestAnimationFrame/);
|
|
assert.match(source, /themeFingerprint/);
|
|
assert.match(source, /export function applyChromeThemeForTab/);
|
|
assert.match(source, /export function notifyActiveChromeThemeForTab/);
|
|
// Tab path must not use view transitions.
|
|
assert.doesNotMatch(source, /mode:\s*['"]view['"]/);
|
|
});
|
|
|
|
test("syncActiveChromeTheme applies terminal chrome with instant mode", () => {
|
|
assert.match(chromeThemeSource, /mode:\s*['"]instant['"]/);
|
|
assert.match(chromeThemeSource, /nextFingerprint === appliedFingerprint/);
|
|
});
|