refine Semi UI mobile history tools

This commit is contained in:
lingniu
2026-07-18 15:15:37 +08:00
parent 50b5107bc2
commit b764ba1be8
3 changed files with 84 additions and 19 deletions

View File

@@ -215,6 +215,9 @@ test('renders only selectable Semi history cards on mobile', async () => {
expect(screen.queryByLabelText('表格密度')).not.toBeInTheDocument();
expect(view.container.querySelector('.v2-history-side')).not.toBeInTheDocument();
expect(mocks.historyExports).not.toHaveBeenCalled();
expect(screen.getByRole('button', { name: '展开趋势' })).toHaveTextContent('趋势');
expect(screen.getByRole('button', { name: '打开历史数据工具' })).toHaveTextContent('工具');
expect(screen.queryByText('坐标、速度、里程及设备/服务时间通过基础校验')).not.toBeInTheDocument();
fireEvent.click(action);
expect(action).toHaveAttribute('aria-pressed', 'true');
expect(action).toHaveAttribute('aria-expanded', 'true');
@@ -228,25 +231,27 @@ test('renders only selectable Semi history cards on mobile', async () => {
expect(document.body.style.overflow).not.toBe('hidden');
expect(screen.queryByText('MOBILEVIN-evidence')).not.toBeInTheDocument();
const exportJobsButton = screen.getByRole('button', { name: '查看导出任务' });
fireEvent.click(exportJobsButton);
const toolsButton = screen.getByRole('button', { name: '打开历史数据工具' });
fireEvent.click(toolsButton);
await waitFor(() => expect(toolsButton).toHaveAttribute('aria-expanded', 'true'));
fireEvent.click(screen.getByRole('menuitem', { name: /导出任务/ }));
expect(await screen.findByRole('dialog', { name: '历史数据导出任务' })).toBeInTheDocument();
expect(document.querySelector('.v2-history-export-sidesheet')).toHaveClass('semi-sidesheet-bottom');
expect(document.querySelector('.v2-history-export-sidesheet .semi-sidesheet-inner')).toHaveStyle({ height: 'min(76dvh, 680px)' });
await waitFor(() => expect(mocks.historyExports).toHaveBeenCalledTimes(1));
expect(screen.getByText('暂无导出任务')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '关闭历史数据导出任务' }));
expect(exportJobsButton).toHaveAttribute('aria-expanded', 'false');
expect(toolsButton).toHaveAttribute('aria-expanded', 'false');
expect(document.body.style.overflow).not.toBe('hidden');
expect(screen.queryByText('暂无导出任务')).not.toBeInTheDocument();
const columnSettingsButton = screen.getByRole('button', { name: '列设置' });
fireEvent.click(columnSettingsButton);
fireEvent.click(toolsButton);
fireEvent.click(screen.getByRole('menuitem', { name: /字段设置/ }));
expect(await screen.findByRole('dialog', { name: '列显示设置' })).toBeInTheDocument();
expect(document.querySelector('.v2-history-column-sidesheet')).toHaveClass('semi-sidesheet-bottom');
expect(document.querySelector('.v2-history-column-sidesheet .semi-sidesheet-inner')).toHaveStyle({ height: 'min(68dvh, 580px)' });
fireEvent.click(screen.getByRole('button', { name: '关闭列显示设置' }));
expect(columnSettingsButton).toHaveAttribute('aria-expanded', 'false');
expect(toolsButton).toHaveAttribute('aria-expanded', 'false');
});
test('releases export job state immediately after leaving the history page', async () => {