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
54 lines
3.1 KiB
TypeScript
54 lines
3.1 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
|
|
import {
|
|
nextTerminalFontSizeForAction,
|
|
nextTerminalFontSizeForWheel,
|
|
shouldHandleTerminalFontSizeAction,
|
|
terminalFontSizeWheelListenerOptions,
|
|
} from './terminalFontZoom.ts';
|
|
|
|
test('terminal font size actions step and reset within bounds', () => {
|
|
assert.equal(nextTerminalFontSizeForAction('increaseTerminalFontSize', 14), 15);
|
|
assert.equal(nextTerminalFontSizeForAction('decreaseTerminalFontSize', 14), 13);
|
|
assert.equal(nextTerminalFontSizeForAction('resetTerminalFontSize', 18), 14);
|
|
assert.equal(nextTerminalFontSizeForAction('increaseTerminalFontSize', 32), 32);
|
|
assert.equal(nextTerminalFontSizeForAction('decreaseTerminalFontSize', 10), 10);
|
|
assert.equal(nextTerminalFontSizeForAction('copy', 14), null);
|
|
});
|
|
|
|
test('terminal font size actions return null when terminal font zoom is disabled', () => {
|
|
assert.equal(nextTerminalFontSizeForAction('increaseTerminalFontSize', 14, true), null);
|
|
assert.equal(nextTerminalFontSizeForAction('decreaseTerminalFontSize', 14, true), null);
|
|
assert.equal(nextTerminalFontSizeForAction('resetTerminalFontSize', 18, true), null);
|
|
});
|
|
|
|
test('terminal font size actions are not handled when terminal font zoom is disabled', () => {
|
|
assert.equal(shouldHandleTerminalFontSizeAction('increaseTerminalFontSize', false), true);
|
|
assert.equal(shouldHandleTerminalFontSizeAction('decreaseTerminalFontSize', false), true);
|
|
assert.equal(shouldHandleTerminalFontSizeAction('resetTerminalFontSize', false), true);
|
|
assert.equal(shouldHandleTerminalFontSizeAction('increaseTerminalFontSize', true), false);
|
|
assert.equal(shouldHandleTerminalFontSizeAction('copy', true), false);
|
|
});
|
|
|
|
test('wheel adjusts terminal font size with the platform modifier only', () => {
|
|
assert.equal(nextTerminalFontSizeForWheel({ ctrlKey: true, metaKey: false, deltaY: -1 }, 14, false), 15);
|
|
assert.equal(nextTerminalFontSizeForWheel({ ctrlKey: true, metaKey: false, deltaY: 1 }, 14, false), 13);
|
|
assert.equal(nextTerminalFontSizeForWheel({ ctrlKey: false, metaKey: true, deltaY: -1 }, 14, true), 15);
|
|
assert.equal(nextTerminalFontSizeForWheel({ ctrlKey: false, metaKey: true, deltaY: 1 }, 14, true), 13);
|
|
assert.equal(nextTerminalFontSizeForWheel({ ctrlKey: false, metaKey: true, deltaY: -1 }, 14, false), null);
|
|
assert.equal(nextTerminalFontSizeForWheel({ ctrlKey: true, metaKey: false, deltaY: -1 }, 14, true), null);
|
|
assert.equal(nextTerminalFontSizeForWheel({ ctrlKey: false, metaKey: false, deltaY: -1 }, 14, false), null);
|
|
assert.equal(nextTerminalFontSizeForWheel({ ctrlKey: true, metaKey: false, deltaY: 0 }, 14, false), null);
|
|
});
|
|
|
|
test('wheel zoom returns null when terminal font zoom is disabled', () => {
|
|
assert.equal(nextTerminalFontSizeForWheel({ ctrlKey: true, metaKey: false, deltaY: -1 }, 14, false, true), null);
|
|
assert.equal(nextTerminalFontSizeForWheel({ ctrlKey: false, metaKey: true, deltaY: -1 }, 14, true, true), null);
|
|
});
|
|
|
|
test('wheel font-size listener runs before xterm consumes terminal scrolling', () => {
|
|
assert.equal(terminalFontSizeWheelListenerOptions.capture, true);
|
|
assert.equal(terminalFontSizeWheelListenerOptions.passive, false);
|
|
});
|