Files
SenMeshNet/domain/keyBindings.terminalFontSize.test.ts
zhaolei 2f9f8da48e
Some checks failed
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
Initial commit: NetMesh smart ops platform with 3D topology, inspection reports, RCA and AI ops assistant
2026-10-15 13:53:04 +08:00

45 lines
2.0 KiB
TypeScript

import assert from 'node:assert/strict';
import test from 'node:test';
import { DEFAULT_KEY_BINDINGS, matchesKeyBinding } from './models/keyBindings.ts';
import { getTerminalPassthroughActions } from '../application/state/useGlobalHotkeys.ts';
test('default shortcuts include terminal font size controls', () => {
const byAction = new Map(DEFAULT_KEY_BINDINGS.map((binding) => [binding.action, binding]));
assert.equal(byAction.get('increaseTerminalFontSize')?.pc, 'Ctrl + =');
assert.equal(byAction.get('decreaseTerminalFontSize')?.pc, 'Ctrl + -');
assert.equal(byAction.get('resetTerminalFontSize')?.pc, 'Ctrl + 0');
assert.equal(byAction.get('increaseTerminalFontSize')?.category, 'terminal');
assert.equal(byAction.get('decreaseTerminalFontSize')?.category, 'terminal');
assert.equal(byAction.get('resetTerminalFontSize')?.category, 'terminal');
});
test('terminal font size shortcuts are handled inside xterm', () => {
const actions = getTerminalPassthroughActions();
assert.equal(actions.has('increaseTerminalFontSize'), true);
assert.equal(actions.has('decreaseTerminalFontSize'), true);
assert.equal(actions.has('resetTerminalFontSize'), true);
});
test('pane magnification uses Alt+M without colliding with existing defaults', () => {
const binding = DEFAULT_KEY_BINDINGS.find((entry) => entry.id === 'toggle-pane-zoom');
assert.equal(binding?.mac, '⌥ + M');
assert.equal(binding?.pc, 'Alt + M');
assert.equal(matchesKeyBinding({
key: 'µ',
code: 'KeyM',
metaKey: false,
ctrlKey: false,
altKey: true,
shiftKey: false,
} as KeyboardEvent, binding?.mac ?? '', true), true);
const duplicatePcShortcuts = DEFAULT_KEY_BINDINGS.filter((entry) => entry.pc === binding?.pc);
const duplicateMacShortcuts = DEFAULT_KEY_BINDINGS.filter((entry) => entry.mac === binding?.mac);
assert.deepEqual(duplicatePcShortcuts.map((entry) => entry.id), ['toggle-pane-zoom']);
assert.deepEqual(duplicateMacShortcuts.map((entry) => entry.id), ['toggle-pane-zoom']);
});