mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
85bddba538
* fix(#3481): automated AI fix * fix: address Codex review on PR #3482 * fix: address Codex review on PR #3482 * fix: address Codex review on PR #3482 * fix: address Codex review on PR #3482 * fix: address Codex review on PR #3482 * fix: remeasure bottom dock when compose bar toggles * fix: preserve terminal height when bottom dock cannot fit * fix: preserve dock preference through temporary shrinkage * fix: update bottom dock when compose bar toggles --------- Co-authored-by: netcatty-bot <308658023+netcatty-bot@users.noreply.github.com> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
56 lines
2.6 KiB
TypeScript
56 lines
2.6 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
|
|
import {
|
|
clampTerminalSidePanelHeight,
|
|
clampTerminalSidePanelWidth,
|
|
getTerminalSidePanelAvailableWidth,
|
|
getTerminalSidePanelMaxShownTools,
|
|
getTerminalSidePanelMaxWidth,
|
|
getTerminalSidePanelAvailableHeight,
|
|
getTerminalSidePanelMaxHeight,
|
|
TERMINAL_SIDE_PANEL_MAX_HEIGHT,
|
|
TERMINAL_SIDE_PANEL_MIN_HEIGHT,
|
|
TERMINAL_SIDE_PANEL_MAX_WIDTH,
|
|
TERMINAL_SIDE_PANEL_MIN_WIDTH,
|
|
} from './terminalSidePanelWidth.ts';
|
|
|
|
test('terminal side panel can expand to the wider maximum', () => {
|
|
assert.equal(getTerminalSidePanelMaxWidth(2000), TERMINAL_SIDE_PANEL_MAX_WIDTH);
|
|
assert.equal(clampTerminalSidePanelWidth(1400, 2000), TERMINAL_SIDE_PANEL_MAX_WIDTH);
|
|
});
|
|
|
|
test('terminal side panel collapses tool buttons before shared actions are clipped', () => {
|
|
assert.equal(getTerminalSidePanelMaxShownTools(280), 2);
|
|
assert.equal(getTerminalSidePanelMaxShownTools(320), 4);
|
|
assert.ok(getTerminalSidePanelMaxShownTools(420) >= 7);
|
|
});
|
|
|
|
test('terminal side panel uses the actual surface left after fixed sibling panels', () => {
|
|
assert.equal(getTerminalSidePanelAvailableWidth(780, 220), 560);
|
|
assert.equal(getTerminalSidePanelMaxWidth(560), TERMINAL_SIDE_PANEL_MIN_WIDTH);
|
|
assert.equal(clampTerminalSidePanelWidth(680, 560), TERMINAL_SIDE_PANEL_MIN_WIDTH);
|
|
});
|
|
|
|
test('terminal side panel keeps usable terminal space in smaller windows', () => {
|
|
assert.equal(getTerminalSidePanelMaxWidth(1000), 680);
|
|
assert.equal(clampTerminalSidePanelWidth(900, 1000), 680);
|
|
assert.equal(clampTerminalSidePanelWidth(100, 1000), TERMINAL_SIDE_PANEL_MIN_WIDTH);
|
|
assert.equal(clampTerminalSidePanelWidth(280, 1000, 401), 401);
|
|
assert.equal(clampTerminalSidePanelWidth(280, 600, 401), TERMINAL_SIDE_PANEL_MIN_WIDTH);
|
|
});
|
|
|
|
test('terminal side panel bottom dock clamps height against surface height', () => {
|
|
assert.equal(getTerminalSidePanelAvailableHeight(1000, 200), 800);
|
|
assert.equal(getTerminalSidePanelMaxHeight(1000), 760);
|
|
assert.equal(clampTerminalSidePanelHeight(900, 1000), 760);
|
|
assert.equal(clampTerminalSidePanelHeight(100, 1000), TERMINAL_SIDE_PANEL_MIN_HEIGHT);
|
|
assert.equal(clampTerminalSidePanelHeight(300, 1000, 500), 500);
|
|
assert.equal(clampTerminalSidePanelHeight(5000, 4000), TERMINAL_SIDE_PANEL_MAX_HEIGHT);
|
|
// A tall compose bar in the smallest window leaves less than the nominal
|
|
// panel minimum; the terminal's 240px reserve must still win.
|
|
assert.equal(getTerminalSidePanelMaxHeight(244), 4);
|
|
assert.equal(clampTerminalSidePanelHeight(560, 244), 4);
|
|
assert.equal(clampTerminalSidePanelHeight(560, 220), 0);
|
|
});
|