feat: refine mobile vehicle detail actions
This commit is contained in:
@@ -518,7 +518,7 @@ test('uses compact Semi telemetry evidence cards on mobile', async () => {
|
||||
});
|
||||
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
||||
|
||||
render(<QueryClientProvider client={client}><MemoryRouter initialEntries={[`/vehicles/${initialRealtime.vin}`]} future={ROUTER_FUTURE}><Routes><Route path="/vehicles/:vin" element={<VehiclePage />} /></Routes></MemoryRouter></QueryClientProvider>);
|
||||
render(<QueryClientProvider client={client}><MemoryRouter initialEntries={[`/vehicles/${initialRealtime.vin}`]} future={ROUTER_FUTURE}><Routes><Route path="/vehicles/:vin" element={<VehiclePage />} /><Route path="/history" element={<div data-testid="mobile-history-route">历史数据页面</div>} /></Routes></MemoryRouter></QueryClientProvider>);
|
||||
|
||||
expect(await screen.findByText('GPS 速度')).toBeInTheDocument();
|
||||
expect(document.querySelector('.v2-telemetry-table')).not.toBeInTheDocument();
|
||||
@@ -532,8 +532,21 @@ test('uses compact Semi telemetry evidence cards on mobile', async () => {
|
||||
expect(document.querySelector('.v2-telemetry-detail-protocol')).toHaveClass('semi-tag-cyan-light');
|
||||
expect(screen.getByRole('button', { name: '关闭遥测字段详情' })).toBeInTheDocument();
|
||||
expect(document.querySelector('.v2-vehicle-record-page')).toHaveClass('v2-vehicle-record-v3', 'is-mobile-layout');
|
||||
expect(screen.getByRole('group', { name: '车辆快捷操作' }).querySelectorAll('.semi-button')).toHaveLength(5);
|
||||
expect(screen.getByRole('group', { name: '车辆快捷操作' })).toHaveTextContent('切换车辆轨迹回放历史数据里程查询告警事件');
|
||||
const mobileActions = screen.getByRole('group', { name: '车辆快捷操作' });
|
||||
expect(mobileActions.querySelectorAll('.semi-button')).toHaveLength(3);
|
||||
expect(mobileActions).toHaveTextContent('切换车辆轨迹回放更多');
|
||||
expect(mobileActions).not.toHaveTextContent('历史数据里程查询告警事件');
|
||||
const moreActions = screen.getByRole('button', { name: '更多车辆操作' });
|
||||
expect(moreActions).toHaveAttribute('aria-haspopup', 'dialog');
|
||||
expect(moreActions).toHaveAttribute('aria-controls', 'v2-vehicle-mobile-actions');
|
||||
expect(moreActions).toHaveAttribute('aria-expanded', 'false');
|
||||
fireEvent.click(moreActions);
|
||||
expect(await screen.findByRole('dialog', { name: '更多车辆操作' })).toBeVisible();
|
||||
expect(document.querySelector('.v2-vehicle-mobile-actions-sidesheet')).toHaveClass('semi-sidesheet-bottom');
|
||||
expect(screen.getByRole('button', { name: '历史数据' })).toBeVisible();
|
||||
expect(screen.getByRole('button', { name: '里程查询' })).toBeVisible();
|
||||
expect(screen.getByRole('button', { name: '告警事件' })).toBeVisible();
|
||||
expect(screen.getByRole('button', { name: '关闭更多车辆操作' })).toBeInTheDocument();
|
||||
expect(document.querySelectorAll('.v2-identity-sources .semi-tag')).toHaveLength(3);
|
||||
expect(document.querySelector('.v2-identity-sources')).toHaveTextContent('GB/T 32960JT/T 808宇通 MQTT');
|
||||
expect(document.querySelector('.v2-identity-sources .semi-tag-blue-light')).toHaveTextContent('GB/T 32960');
|
||||
@@ -544,4 +557,6 @@ test('uses compact Semi telemetry evidence cards on mobile', async () => {
|
||||
expect(document.querySelector('.v2-live-metric.is-speed')).toHaveTextContent('速度');
|
||||
expect(document.querySelector('.v2-live-metric.is-today-mileage')).toHaveTextContent('当日里程');
|
||||
expect(document.querySelector('.v2-live-metric.is-source-status')).toHaveTextContent('来源状态');
|
||||
fireEvent.click(screen.getByRole('button', { name: '历史数据' }));
|
||||
expect(await screen.findByTestId('mobile-history-route')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user