feat: unify mobile history filters
This commit is contained in:
@@ -194,6 +194,38 @@ test('clears stale rows, charts, and evidence as soon as the history scope chang
|
||||
await waitFor(() => expect(screen.queryByRole('status')).not.toBeInTheDocument());
|
||||
});
|
||||
|
||||
test('uses one focused Semi bottom SideSheet for the complete mobile history query', async () => {
|
||||
layout.mobile = true;
|
||||
mocks.historyMetricCatalog.mockResolvedValue({ categories: [{ key: 'location', label: '位置数据' }], metrics: [metric] });
|
||||
mocks.historyData.mockResolvedValue(historyData('MOBILEVIN', '粤A移动历史', 'mobile-as-of'));
|
||||
mocks.historySeries.mockResolvedValue(historySeries('MOBILEVIN', '粤A移动历史', 'mobile-as-of'));
|
||||
mocks.historyExports.mockResolvedValue([]);
|
||||
renderPage('/history');
|
||||
|
||||
await screen.findByText('等待查询历史数据');
|
||||
const trigger = screen.getByRole('button', { name: '修改查询范围:请选择车辆' });
|
||||
expect(trigger).toHaveAttribute('aria-expanded', 'false');
|
||||
fireEvent.click(trigger);
|
||||
|
||||
const dialog = await screen.findByRole('dialog', { name: '历史查询范围' });
|
||||
expect(document.querySelector('.v2-history-filter-sidesheet')).toHaveClass('semi-sidesheet-bottom');
|
||||
expect(document.querySelector('.v2-history-filter-sidesheet .semi-sidesheet-inner')).toHaveStyle({ height: 'min(82dvh, 700px)' });
|
||||
expect(within(dialog).getByPlaceholderText('车牌 / VIN,多台用逗号分隔')).toBeInTheDocument();
|
||||
expect(within(dialog).getByLabelText('开始时间')).toBeInTheDocument();
|
||||
expect(within(dialog).getByLabelText('结束时间')).toBeInTheDocument();
|
||||
expect(within(dialog).getByRole('combobox', { name: '数据类型' })).toBeInTheDocument();
|
||||
expect(within(dialog).getByRole('combobox', { name: '数据来源' })).toBeInTheDocument();
|
||||
fireEvent.change(within(dialog).getByPlaceholderText('车牌 / VIN,多台用逗号分隔'), { target: { value: 'MOBILEVIN' } });
|
||||
fireEvent.click(within(dialog).getByRole('button', { name: '应用并查询' }));
|
||||
|
||||
await waitFor(() => {
|
||||
const calls = mocks.historyData.mock.calls;
|
||||
expect((calls[calls.length - 1]?.[0] as URLSearchParams | undefined)?.get('keywords')).toBe('MOBILEVIN');
|
||||
});
|
||||
expect(screen.getByRole('button', { name: '修改查询范围:1 辆 · 位置数据' })).toHaveAttribute('aria-expanded', 'false');
|
||||
expect(screen.getByRole('dialog', { name: '历史查询范围' })).toHaveClass('semi-sidesheet-animation-content_hide_bottom');
|
||||
});
|
||||
|
||||
test('renders only selectable Semi history cards on mobile', async () => {
|
||||
layout.mobile = true;
|
||||
mocks.historyMetricCatalog.mockResolvedValue({ categories: [{ key: 'location', label: '位置数据' }], metrics: [metric] });
|
||||
|
||||
Reference in New Issue
Block a user