2025-11-24 23:11:46 +05:30
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright 2025 Google LLC
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
2026-02-27 07:55:02 -08:00
|
|
|
import { describe, it, expect } from 'vitest';
|
2025-11-24 23:11:46 +05:30
|
|
|
import { calculateMainAreaWidth } from './ui-sizing.js';
|
2026-02-27 07:55:02 -08:00
|
|
|
import type { Config } from '@google/gemini-cli-core';
|
2025-11-24 23:11:46 +05:30
|
|
|
|
|
|
|
|
describe('ui-sizing', () => {
|
|
|
|
|
describe('calculateMainAreaWidth', () => {
|
|
|
|
|
it.each([
|
2026-01-26 15:23:54 -08:00
|
|
|
// expected, width, altBuffer
|
|
|
|
|
[80, 80, false],
|
|
|
|
|
[100, 100, false],
|
|
|
|
|
[79, 80, true],
|
|
|
|
|
[99, 100, true],
|
2025-11-24 23:11:46 +05:30
|
|
|
])(
|
2026-01-26 15:23:54 -08:00
|
|
|
'should return %i when width=%i and altBuffer=%s',
|
|
|
|
|
(expected, width, altBuffer) => {
|
2026-02-27 07:55:02 -08:00
|
|
|
const mockConfig = {
|
|
|
|
|
getUseAlternateBuffer: () => altBuffer,
|
2026-04-02 17:39:49 -07:00
|
|
|
getUseTerminalBuffer: () => false,
|
2026-02-27 07:55:02 -08:00
|
|
|
} as unknown as Config;
|
|
|
|
|
expect(calculateMainAreaWidth(width, mockConfig)).toBe(expected);
|
2025-11-24 23:11:46 +05:30
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
});
|