mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-13 01:54:20 +08:00
- 基于 TypeScript AST 精确识别 readFileSync 派生变量及其断言,仅删除不改写保留代码 - 断言全为源码文本的 it() 块整块移除,混合块中只剔除单条源码断言 - 清理随之失效的变量声明、空 it()/describe() 与无用 import,6 个文件因无用例残留而删除 - 累计移除 1283 处代码区间、8270 行,守卫基线由 130 条收敛至 12 条 - 全量测试失败集合无新增,TabManager 悬浮信息用例的 CRLF 误报一并消除 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
33 lines
1.4 KiB
TypeScript
33 lines
1.4 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import {
|
|
V2_WORKBENCH_TAB_MAX_WIDTH,
|
|
V2_WORKBENCH_TAB_MIN_WIDTH,
|
|
resolveV2WorkbenchTabWidth,
|
|
} from './TabManager';
|
|
|
|
describe('v2 workbench adaptive tab width', () => {
|
|
it('keeps the preferred width when the strip has enough room', () => {
|
|
expect(resolveV2WorkbenchTabWidth(1600, 5)).toBe(V2_WORKBENCH_TAB_MAX_WIDTH);
|
|
expect(resolveV2WorkbenchTabWidth(800, 2)).toBe(V2_WORKBENCH_TAB_MAX_WIDTH);
|
|
});
|
|
|
|
it('shares the available width equally before using overflow', () => {
|
|
expect(resolveV2WorkbenchTabWidth(1000, 5)).toBe(199);
|
|
expect(resolveV2WorkbenchTabWidth(1200, 10)).toBe(119);
|
|
});
|
|
|
|
it('stops shrinking at the readable minimum', () => {
|
|
expect(resolveV2WorkbenchTabWidth(1000, 10)).toBe(V2_WORKBENCH_TAB_MIN_WIDTH);
|
|
expect(resolveV2WorkbenchTabWidth(320, 8)).toBe(V2_WORKBENCH_TAB_MIN_WIDTH);
|
|
});
|
|
|
|
it('uses the preferred width until a measurable strip and tab count exist', () => {
|
|
expect(resolveV2WorkbenchTabWidth(0, 4)).toBe(V2_WORKBENCH_TAB_MAX_WIDTH);
|
|
expect(resolveV2WorkbenchTabWidth(Number.NaN, 4)).toBe(V2_WORKBENCH_TAB_MAX_WIDTH);
|
|
expect(resolveV2WorkbenchTabWidth(1000, 0)).toBe(V2_WORKBENCH_TAB_MAX_WIDTH);
|
|
expect(resolveV2WorkbenchTabWidth(1000, -2)).toBe(V2_WORKBENCH_TAB_MAX_WIDTH);
|
|
expect(resolveV2WorkbenchTabWidth(1000, Number.NaN)).toBe(V2_WORKBENCH_TAB_MAX_WIDTH);
|
|
});
|
|
});
|