mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-12 16:02:48 +08:00
✨ feat(sidebar): 优化对象菜单与旧版布局交互
- 为已存查询右键菜单补充重命名能力并同步已打开标签 - 优化 v2 侧栏与表概览右键菜单定位,避免底部遮挡 - 精简旧版数据视图工具栏布局并统一快捷键显示 - 补充侧栏与表概览菜单回归测试
This commit is contained in:
28
frontend/src/components/TableOverview.context-menu.test.ts
Normal file
28
frontend/src/components/TableOverview.context-menu.test.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
describe('TableOverview v2 context menu', () => {
|
||||
it('renders card and list table context menus through a measured portal', () => {
|
||||
const source = readFileSync(new URL('./TableOverview.tsx', import.meta.url), 'utf8');
|
||||
const cardSource = source.slice(
|
||||
source.indexOf('const renderCardTableContent = (t: TableStatRow) => ('),
|
||||
source.indexOf('const renderListTable = (t: TableStatRow) => {'),
|
||||
);
|
||||
const listSource = source.slice(
|
||||
source.indexOf('const renderListTable = (t: TableStatRow) => {'),
|
||||
source.indexOf('if (loading) {'),
|
||||
);
|
||||
|
||||
expect(source).toContain("import { createPortal } from 'react-dom';");
|
||||
expect(source).toContain('resolveOverviewContextMenuPosition(event.clientX, event.clientY)');
|
||||
expect(source).toContain('v2ContextMenuPortalRef');
|
||||
expect(source).toContain('content?.scrollHeight');
|
||||
expect(source).toContain('gn-v2-table-overview-context-menu-portal');
|
||||
expect(source).toContain("['--gn-v2-context-menu-max-height' as any]");
|
||||
expect(source).toContain('renderV2OverviewTableContextMenu(v2ContextMenuTable)');
|
||||
expect(cardSource).toContain('onContextMenu={isV2Ui ? (event) => openV2OverviewContextMenu(event, t) : undefined}');
|
||||
expect(listSource).toContain('onContextMenu={isV2Ui ? (event) => openV2OverviewContextMenu(event, t) : undefined}');
|
||||
expect(cardSource).not.toContain('popupRender');
|
||||
expect(listSource).not.toContain('popupRender');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user