Files
MyGoNavi/frontend/src/utils/aiEntryLayout.test.ts
Syngnat 24d9db4c51 feat(ui): 完成新版 UI 全量改造
- 整体布局:按新版 UI 重构左侧导航、对象树、连接分组和右键菜单体系

- 数据视图:优化 DDL 侧栏、横向滚动、筛选输入、编辑入口和虚拟表格体验

- AI 面板:重构新版入口、输入区、模型选择、快捷键和悬浮布局

- 标签与快捷键:补齐 Tab 悬浮信息、复制交互和 Mac/Windows 快捷键配置

- 工程质量:新增 v2 主题样式、菜单组件、外观工具和回归测试覆盖
2026-05-22 17:41:06 +08:00

54 lines
1.7 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import {
SIDEBAR_UTILITY_ITEM_KEYS,
resolveLegacyAIEdgeHandleAttachment,
resolveLegacyAIEdgeHandleDockStyle,
resolveLegacyAIEdgeHandleStyle,
} from './aiEntryLayout';
describe('ai entry layout', () => {
it('keeps legacy sidebar utility buttons limited to tools and settings', () => {
expect(SIDEBAR_UTILITY_ITEM_KEYS).toEqual(['tools', 'settings']);
});
it('attaches the legacy closed AI handle to the content shell', () => {
expect(resolveLegacyAIEdgeHandleAttachment(false)).toBe('content-shell');
});
it('attaches the legacy open AI handle to the panel shell', () => {
expect(resolveLegacyAIEdgeHandleAttachment(true)).toBe('panel-shell');
});
it('keeps the legacy closed handle docked on the content edge', () => {
expect(resolveLegacyAIEdgeHandleDockStyle('content-shell')).toMatchObject({
position: 'absolute',
top: 16,
right: 0,
zIndex: 12,
});
});
it('keeps the legacy open handle outside the panel shell to avoid header overlap', () => {
expect(resolveLegacyAIEdgeHandleDockStyle('panel-shell')).toMatchObject({
position: 'absolute',
top: 16,
right: '100%',
zIndex: 12,
});
});
it('uses the attached active appearance when the legacy AI panel is open', () => {
const style = resolveLegacyAIEdgeHandleStyle({
darkMode: true,
aiPanelVisible: true,
effectiveUiScale: 1,
});
expect(style.color).toBe('#ffd666');
expect(style.background).toBe('rgba(255,214,102,0.12)');
expect(style.borderRadius).toBe('10px 0 0 10px');
expect(style.borderRight).toBe('none');
expect(style.height).toBe(24);
});
});