refine Semi UI history workspace
This commit is contained in:
@@ -5,7 +5,7 @@ import { MemoryRouter } from 'react-router-dom';
|
||||
import type { HistoryDataResponse, HistorySeriesResponse } from '../../api/types';
|
||||
import { buildMonitorPath, withMonitorReturn } from '../routing/monitorContext';
|
||||
import { ROUTER_FUTURE } from '../routing/routerConfig';
|
||||
import HistoryPage from './HistoryPage';
|
||||
import HistoryPage, { formatHistoryDateTime } from './HistoryPage';
|
||||
|
||||
const mocks = vi.hoisted(() => ({
|
||||
historyMetricCatalog: vi.fn(),
|
||||
@@ -54,6 +54,12 @@ function renderPage(initialEntry = '/history?keywords=OLDVIN&dateFrom=2026-07-16
|
||||
return { ...view, client };
|
||||
}
|
||||
|
||||
test('renders protocol timestamps in Asia/Shanghai while preserving local values', () => {
|
||||
expect(formatHistoryDateTime('2026-07-18T02:33:00Z')).toBe('2026-07-18 10:33:00');
|
||||
expect(formatHistoryDateTime('2026-07-18T02:33:00+08:00')).toBe('2026-07-18 02:33:00');
|
||||
expect(formatHistoryDateTime('2026-07-18 02:33:00')).toBe('2026-07-18 02:33:00');
|
||||
});
|
||||
|
||||
test('preserves the exact monitor return after changing history filters', async () => {
|
||||
mocks.historyMetricCatalog.mockResolvedValue({ categories: [{ key: 'location', label: '位置数据' }], metrics: [metric] });
|
||||
mocks.historyData.mockResolvedValue(historyData('OLDVIN', '旧车牌', 'old-as-of'));
|
||||
@@ -113,6 +119,9 @@ test('clears stale rows, charts, and evidence as soon as the history scope chang
|
||||
for (const className of ['v2-history-filter-card', 'v2-history-summary-rail', 'v2-history-table-card']) {
|
||||
expect(view.container.querySelector(`.${className}.semi-card`)).toBeInTheDocument();
|
||||
}
|
||||
expect(view.container.querySelector('.v2-history-discovery-shell')).toContainElement(screen.getByLabelText('历史数据查询操作'));
|
||||
expect(screen.getByLabelText('历史数据查询操作')).toHaveTextContent('遥测证据检索');
|
||||
expect(screen.getByLabelText('历史数据查询操作')).toHaveTextContent('上海时区');
|
||||
expect(view.container.querySelector('.v2-history-summary-rail')).toHaveAttribute('aria-label', '历史数据查询统计信息');
|
||||
expect(view.container.querySelector('.v2-history-summary-secondary.semi-card-group')).toBeInTheDocument();
|
||||
expect(view.container.querySelectorAll('.v2-history-summary-card.semi-card')).toHaveLength(4);
|
||||
@@ -240,6 +249,7 @@ test('opens a working column visibility panel and preserves non-hideable identit
|
||||
const view = renderPage();
|
||||
|
||||
expect(await screen.findByRole('columnheader', { name: '速度 (km/h)' })).toBeInTheDocument();
|
||||
expect(view.container.querySelector('.v2-history-time')).toHaveTextContent('2026-07-16 04:00:00');
|
||||
expect(screen.queryByRole('columnheader', { name: 'SOC (%)' })).not.toBeInTheDocument();
|
||||
expect(view.container.querySelector('.v2-history-metric-scroll')).not.toBeInTheDocument();
|
||||
expect(screen.getByText('1 / 2 字段').closest('.semi-tag')).toBeInTheDocument();
|
||||
|
||||
Reference in New Issue
Block a user