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
69 lines
2.2 KiB
TypeScript
69 lines
2.2 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
|
|
import {
|
|
findActiveSystemShortcutConflict,
|
|
listActiveSystemBindings,
|
|
} from './activeKeyBindings.ts';
|
|
import { DEFAULT_KEY_BINDINGS, type KeyBinding } from './models/keyBindings.ts';
|
|
|
|
const withBindingOverride = (
|
|
id: string,
|
|
override: Partial<Pick<KeyBinding, 'mac' | 'pc'>>,
|
|
): KeyBinding[] => (
|
|
DEFAULT_KEY_BINDINGS.map((binding) => (
|
|
binding.id === id ? { ...binding, ...override } : binding
|
|
))
|
|
);
|
|
|
|
test('disabled scheme exposes no active system bindings', () => {
|
|
assert.deepEqual(listActiveSystemBindings('disabled', DEFAULT_KEY_BINDINGS), []);
|
|
});
|
|
|
|
test('disabled scheme does not treat default tab or broadcast keys as occupied', () => {
|
|
assert.equal(
|
|
findActiveSystemShortcutConflict('Ctrl + 1', 'disabled', DEFAULT_KEY_BINDINGS),
|
|
null,
|
|
);
|
|
assert.equal(
|
|
findActiveSystemShortcutConflict('Ctrl + B', 'disabled', DEFAULT_KEY_BINDINGS),
|
|
null,
|
|
);
|
|
assert.equal(
|
|
findActiveSystemShortcutConflict('⌘ + 1', 'disabled', DEFAULT_KEY_BINDINGS),
|
|
null,
|
|
);
|
|
});
|
|
|
|
test('pc scheme reports the tab-switch binding for Ctrl+1', () => {
|
|
const conflict = findActiveSystemShortcutConflict('Ctrl + 1', 'pc', DEFAULT_KEY_BINDINGS);
|
|
|
|
assert.equal(conflict?.id, 'switch-tab-1-9');
|
|
});
|
|
|
|
test('pc scheme reports the broadcast binding for Ctrl+B', () => {
|
|
const conflict = findActiveSystemShortcutConflict('Ctrl + B', 'pc', DEFAULT_KEY_BINDINGS);
|
|
|
|
assert.equal(conflict?.id, 'broadcast');
|
|
});
|
|
|
|
test('mac scheme does not treat Ctrl+1 as a tab shortcut', () => {
|
|
assert.equal(
|
|
findActiveSystemShortcutConflict('Ctrl + 1', 'mac', DEFAULT_KEY_BINDINGS),
|
|
null,
|
|
);
|
|
});
|
|
|
|
test('mac scheme reports the tab-switch binding for Cmd+1', () => {
|
|
const conflict = findActiveSystemShortcutConflict('⌘ + 1', 'mac', DEFAULT_KEY_BINDINGS);
|
|
|
|
assert.equal(conflict?.id, 'switch-tab-1-9');
|
|
});
|
|
|
|
test('a Disabled individual binding is not a conflict', () => {
|
|
const bindings = withBindingOverride('switch-tab-1-9', { pc: 'Disabled' });
|
|
|
|
assert.equal(findActiveSystemShortcutConflict('Ctrl + 1', 'pc', bindings), null);
|
|
assert.equal(findActiveSystemShortcutConflict('Ctrl + B', 'pc', bindings)?.id, 'broadcast');
|
|
});
|