mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-06-17 03:59:41 +08:00
🐛 fix(ui): 修复新版数据视图布局与 AI 面板加载容错
- 修复新版数据视图底部分页、列快速定位与当前页查找的对齐和压缩问题 - 优化窄屏下 AI 面板布局,避免挤压工作区并增加懒加载失败重试兜底 - 补充窗口运行时、AI 面板布局与 UI 回归测试,更新相关样式快照
This commit is contained in:
63
frontend/src/utils/aiPanelLayout.test.ts
Normal file
63
frontend/src/utils/aiPanelLayout.test.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import {
|
||||
DEFAULT_AI_PANEL_WIDTH,
|
||||
resolveOverlayAIPanelWidth,
|
||||
shouldOverlayAIPanel,
|
||||
} from './aiPanelLayout';
|
||||
|
||||
describe('aiPanelLayout', () => {
|
||||
it('keeps the v2 AI panel docked while enough workbench width remains', () => {
|
||||
expect(shouldOverlayAIPanel({
|
||||
isV2Ui: true,
|
||||
viewportWidth: 1440,
|
||||
sidebarWidth: 330,
|
||||
panelWidth: DEFAULT_AI_PANEL_WIDTH,
|
||||
minWorkbenchWidth: 320,
|
||||
})).toBe(false);
|
||||
});
|
||||
|
||||
it('switches the v2 AI panel to overlay mode when docking would crush the workbench', () => {
|
||||
expect(shouldOverlayAIPanel({
|
||||
isV2Ui: true,
|
||||
viewportWidth: 825,
|
||||
sidebarWidth: 330,
|
||||
panelWidth: DEFAULT_AI_PANEL_WIDTH,
|
||||
minWorkbenchWidth: 320,
|
||||
})).toBe(true);
|
||||
});
|
||||
|
||||
it('also protects the legacy UI from being crushed by the AI panel', () => {
|
||||
expect(shouldOverlayAIPanel({
|
||||
isV2Ui: false,
|
||||
viewportWidth: 825,
|
||||
sidebarWidth: 330,
|
||||
})).toBe(true);
|
||||
});
|
||||
|
||||
it('clamps overlay width to the available workspace instead of overflowing', () => {
|
||||
expect(resolveOverlayAIPanelWidth({
|
||||
viewportWidth: 825,
|
||||
sidebarWidth: 330,
|
||||
panelWidth: DEFAULT_AI_PANEL_WIDTH,
|
||||
minOverlayWidth: 260,
|
||||
overlayGap: 12,
|
||||
})).toBe(380);
|
||||
|
||||
expect(resolveOverlayAIPanelWidth({
|
||||
viewportWidth: 620,
|
||||
sidebarWidth: 330,
|
||||
panelWidth: DEFAULT_AI_PANEL_WIDTH,
|
||||
minOverlayWidth: 260,
|
||||
overlayGap: 12,
|
||||
})).toBe(278);
|
||||
|
||||
expect(resolveOverlayAIPanelWidth({
|
||||
viewportWidth: 540,
|
||||
sidebarWidth: 330,
|
||||
panelWidth: DEFAULT_AI_PANEL_WIDTH,
|
||||
minOverlayWidth: 260,
|
||||
overlayGap: 12,
|
||||
})).toBe(210);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user