Files
Netcatty/components/settings/tabs/TerminalBehaviorSettings.test.ts
T
bincxz 2a52837657 feat(terminal): show desktop notifications for OSC 9/777/99
Closes #3019

Codex and other agents emit OSC 9 when a turn completes or approval
is needed, but Netcatty ignored those sequences. Register OSC 9, 777
notify, and kitty OSC 99 handlers, map them to Electron notifications,
and reuse tray focus so a click jumps back to the emitting session.
Ignore ConEmu OSC 9;n progress sequences so they do not become toasts.
2026-08-18 09:28:11 +08:00

41 lines
1.4 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import React from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { normalizeTerminalSettings } from "../../../domain/models/terminal.ts";
import { TerminalBehaviorSettings } from "./TerminalBehaviorSettings.tsx";
const renderSettings = (autoCloseOnExit: boolean) => renderToStaticMarkup(
React.createElement(TerminalBehaviorSettings, {
t: (key: string) => key,
terminalSettings: normalizeTerminalSettings({ autoCloseOnExit }),
updateTerminalSetting: () => {},
}),
);
test("terminal behavior settings expose enabled auto-close by default", () => {
const markup = renderSettings(true);
assert.match(
markup,
/settings\.terminal\.behavior\.autoCloseOnExit[\s\S]*?role="switch" aria-checked="true"/,
);
});
test("terminal behavior settings expose disabled auto-close", () => {
const markup = renderSettings(false);
assert.match(
markup,
/settings\.terminal\.behavior\.autoCloseOnExit[\s\S]*?role="switch" aria-checked="false"/,
);
});
test("terminal behavior settings expose OSC desktop notification mode", () => {
const markup = renderSettings(true);
assert.match(markup, /settings-anchor-terminal-osc-notifications/);
assert.match(markup, /settings\.terminal\.behavior\.oscNotifications/);
assert.match(markup, /settings\.terminal\.behavior\.oscNotifications\.always/);
});