refine Semi UI history evidence workspace
This commit is contained in:
@@ -136,6 +136,20 @@ test('clears stale rows, charts, and evidence as soon as the history scope chang
|
||||
expect(screen.queryByRole('heading', { level: 5, name: '导出任务' })).not.toBeInTheDocument();
|
||||
expect(view.container.querySelector('.v2-history-data-table.semi-table-wrapper')).toBeInTheDocument();
|
||||
expect(view.container.querySelector('.v2-history-table-scroll > table')).not.toBeInTheDocument();
|
||||
const desktopHistoryScroll = view.container.querySelector<HTMLElement>('.v2-history-table-scroll');
|
||||
expect(desktopHistoryScroll).toHaveAttribute('tabindex', '0');
|
||||
expect(desktopHistoryScroll).toHaveAttribute('aria-label', '历史明细表格,可使用左右方向键浏览业务字段');
|
||||
const desktopTableScroller = desktopHistoryScroll?.querySelector<HTMLElement>('.semi-table-body');
|
||||
expect(desktopTableScroller).toBeInTheDocument();
|
||||
const scrollBy = vi.fn();
|
||||
Object.defineProperty(desktopTableScroller!, 'scrollBy', { configurable: true, value: scrollBy });
|
||||
fireEvent.keyDown(desktopHistoryScroll!, { key: 'ArrowRight' });
|
||||
expect(scrollBy).toHaveBeenCalledWith({ left: 260, behavior: 'smooth' });
|
||||
fireEvent.keyDown(desktopHistoryScroll!, { key: 'ArrowLeft' });
|
||||
expect(scrollBy).toHaveBeenCalledWith({ left: -260, behavior: 'smooth' });
|
||||
expect(screen.getByRole('columnheader', { name: '设备时间' })).toHaveClass('semi-table-cell-fixed-left', 'v2-history-device-time-column');
|
||||
expect(screen.getByRole('columnheader', { name: '车牌' })).toHaveClass('semi-table-cell-fixed-left', 'v2-history-plate-column');
|
||||
expect(view.container.querySelector('th.v2-history-selection-column')).toHaveClass('semi-table-cell-fixed-left');
|
||||
expect(view.container.querySelector('.v2-history-mobile-list')).not.toBeInTheDocument();
|
||||
const desktopHistoryRow = screen.getByTestId('history-row-OLDVIN-row');
|
||||
expect(desktopHistoryRow).toHaveAttribute('role', 'button');
|
||||
@@ -205,6 +219,8 @@ test('renders only selectable Semi history cards on mobile', async () => {
|
||||
expect(action).toHaveAttribute('aria-pressed', 'true');
|
||||
expect(action).toHaveAttribute('aria-expanded', 'true');
|
||||
expect(await screen.findByRole('dialog', { name: '历史数据详情' })).toBeInTheDocument();
|
||||
expect(document.querySelector('.v2-history-detail-sidesheet')).toHaveClass('semi-sidesheet-bottom');
|
||||
expect(document.querySelector('.v2-history-detail-sidesheet .semi-sidesheet-inner')).toHaveStyle({ height: 'min(82dvh, 720px)' });
|
||||
expect(await screen.findByText('MOBILEVIN-evidence')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { name: '关闭历史数据详情' }));
|
||||
expect(action).toHaveAttribute('aria-pressed', 'false');
|
||||
@@ -215,12 +231,22 @@ test('renders only selectable Semi history cards on mobile', async () => {
|
||||
const exportJobsButton = screen.getByRole('button', { name: '查看导出任务' });
|
||||
fireEvent.click(exportJobsButton);
|
||||
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(document.body.style.overflow).not.toBe('hidden');
|
||||
expect(screen.queryByText('暂无导出任务')).not.toBeInTheDocument();
|
||||
|
||||
const columnSettingsButton = screen.getByRole('button', { name: '列设置' });
|
||||
fireEvent.click(columnSettingsButton);
|
||||
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');
|
||||
});
|
||||
|
||||
test('releases export job state immediately after leaving the history page', async () => {
|
||||
|
||||
Reference in New Issue
Block a user