Replace the legacy terminal flow with a shared authenticated WebSocket runtime used across web, desktop, relay, and mobile surfaces. - introduce the v3 terminal protocol with scoped attachments, snapshots, ordered output, bounded replay history, reconnects, and explicit lifecycle - harden PTY creation, restart, resize, close, force-kill, idle cleanup, shell selection, login mode, environment sanitization, and appearance sync - add runtime-aware terminal APIs with relay authentication and Electron parity - add a fullscreen mobile terminal workspace with touch scrolling, long-press selection, safe-area controls, quick keys, and Ctrl/Alt input - add terminal selection attachments, preview detection, project actions, shell settings, and localized UI - harden Ghostty rendering, resize recovery, Unicode handling, block characters, line height, and stale-row behavior - remove the obsolete terminal SSE path and update reverse-proxy guidance - expand terminal runtime, transport, input, selection, and store coverage - avoid duplicate web builds when preparing mobile assets in root CI builds
24 lines
972 B
TypeScript
24 lines
972 B
TypeScript
import { describe, expect, test } from 'bun:test';
|
|
import { getTerminalFocusOwner, isTerminalEventTarget } from './terminalFocus';
|
|
|
|
describe('terminal focus ownership', () => {
|
|
test('finds connected terminal ancestors and rejects detached renderer inputs', () => {
|
|
const originalElement = globalThis.Element;
|
|
class TestElement {
|
|
isConnected = true;
|
|
dataset = { terminalOwner: 'main' };
|
|
closest() { return this; }
|
|
}
|
|
Object.defineProperty(globalThis, 'Element', { configurable: true, value: TestElement });
|
|
try {
|
|
const input = new TestElement() as unknown as Element;
|
|
expect(getTerminalFocusOwner(input)).toBe('main');
|
|
expect(isTerminalEventTarget(input)).toBe(true);
|
|
(input as unknown as TestElement).isConnected = false;
|
|
expect(getTerminalFocusOwner(input)).toBeNull();
|
|
} finally {
|
|
Object.defineProperty(globalThis, 'Element', { configurable: true, value: originalElement });
|
|
}
|
|
});
|
|
});
|