mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-21 21:01:55 +08:00
- 统一侧栏宽度常量,最大宽度放宽到 960px - 拖拽时按窗口宽度预留主工作区空间 - 同步 v2 与 legacy 侧栏 CSS 最大宽度 - 持久化侧栏宽度时允许保存更宽配置并补充测试
24 lines
931 B
TypeScript
24 lines
931 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import {
|
|
DEFAULT_SIDEBAR_WIDTH,
|
|
SIDEBAR_RESIZE_MAX_WIDTH,
|
|
SIDEBAR_RESIZE_MIN_WIDTH,
|
|
resolveSidebarResizeMaxWidth,
|
|
sanitizeSidebarWidth,
|
|
} from './sidebarLayout';
|
|
|
|
describe('sidebar layout bounds', () => {
|
|
it('allows wider persisted sidebar widths while keeping invalid values safe', () => {
|
|
expect(sanitizeSidebarWidth(880)).toBe(880);
|
|
expect(sanitizeSidebarWidth(1200)).toBe(SIDEBAR_RESIZE_MAX_WIDTH);
|
|
expect(sanitizeSidebarWidth(120)).toBe(SIDEBAR_RESIZE_MIN_WIDTH);
|
|
expect(sanitizeSidebarWidth('bad')).toBe(DEFAULT_SIDEBAR_WIDTH);
|
|
});
|
|
|
|
it('keeps enough workbench space when resolving drag width on smaller windows', () => {
|
|
expect(resolveSidebarResizeMaxWidth(1600)).toBe(SIDEBAR_RESIZE_MAX_WIDTH);
|
|
expect(resolveSidebarResizeMaxWidth(1180)).toBe(820);
|
|
expect(resolveSidebarResizeMaxWidth(480)).toBe(SIDEBAR_RESIZE_MIN_WIDTH);
|
|
});
|
|
});
|