refine Semi UI alert workflow
This commit is contained in:
@@ -254,6 +254,9 @@ test('renders only selectable Semi alert cards on mobile', async () => {
|
||||
expect(view.container.querySelector('.v2-alert-table-scroll.is-mobile-scroll')).toHaveAttribute('tabindex', '0');
|
||||
expect(view.container.querySelector('.v2-alert-table-scroll.is-mobile-scroll')).toHaveAttribute('aria-label', '告警事件列表,可上下滚动');
|
||||
expect(view.container.querySelector('.v2-alert-event-table')).not.toBeInTheDocument();
|
||||
expect(view.container.querySelectorAll('.v2-alert-kpis .v2-metric-action')).toHaveLength(3);
|
||||
expect(screen.queryByRole('button', { name: /查看未读通知/ })).not.toBeInTheDocument();
|
||||
expect(screen.getByRole('tab', { name: /站内通知/ })).toBeInTheDocument();
|
||||
expect(action).toHaveAttribute('aria-expanded', 'false');
|
||||
expect(action).toHaveTextContent('超限幅度+10 km/h');
|
||||
expect(action.querySelector('.v2-alert-protocol-tag.semi-tag')).toHaveTextContent('JT/T 808');
|
||||
@@ -298,7 +301,7 @@ test('keeps the primary alert query compact and applies advanced filters from a
|
||||
expect(screen.getByRole('button', { name: /更多筛选 · 1/ })).toHaveAttribute('aria-expanded', 'false');
|
||||
});
|
||||
|
||||
test('uses the shared Semi bottom SideSheet pattern for mobile advanced filters', async () => {
|
||||
test('uses one focused Semi bottom SideSheet for the complete mobile event filter', async () => {
|
||||
layout.mobile = true;
|
||||
mocks.alertSummaryV2.mockResolvedValue({ active: 0, unprocessed: 0, processing: 0, recovered: 0, closed: 0, ignored: 0, unreadNotifications: 0, asOf: '' });
|
||||
mocks.alertEventsV2.mockResolvedValue({ items: [], total: 0, limit: 20, offset: 0 });
|
||||
@@ -308,11 +311,23 @@ test('uses the shared Semi bottom SideSheet pattern for mobile advanced filters'
|
||||
render(<QueryClientProvider client={client}><MemoryRouter future={ROUTER_FUTURE} initialEntries={['/alerts']}><AlertsPage /></MemoryRouter></QueryClientProvider>);
|
||||
|
||||
await screen.findByText('当前筛选条件没有告警事件');
|
||||
fireEvent.click(screen.getByRole('button', { name: /更多筛选/ }));
|
||||
const trigger = screen.getByRole('button', { name: /修改事件筛选/ });
|
||||
expect(trigger).toHaveAttribute('aria-expanded', 'false');
|
||||
fireEvent.click(trigger);
|
||||
|
||||
expect(await screen.findByRole('dialog', { name: '告警高级筛选' })).toBeInTheDocument();
|
||||
expect(document.querySelector('.v2-alert-filter-sidesheet')).toHaveClass('semi-sidesheet-bottom');
|
||||
expect(document.querySelector('.v2-alert-filter-sidesheet .semi-sidesheet-inner')).toHaveStyle({ height: 'min(72dvh, 620px)' });
|
||||
const dialog = await screen.findByRole('dialog', { name: '告警事件筛选' });
|
||||
expect(document.querySelector('.v2-alert-mobile-filter-sidesheet')).toHaveClass('semi-sidesheet-bottom');
|
||||
expect(document.querySelector('.v2-alert-mobile-filter-sidesheet .semi-sidesheet-inner')).toHaveStyle({ height: 'min(82dvh, 690px)' });
|
||||
expect(within(dialog).getByRole('textbox', { name: /关键词/ })).toBeInTheDocument();
|
||||
expect(within(dialog).getByRole('combobox', { name: '协议' })).toBeInTheDocument();
|
||||
expect(within(dialog).getByLabelText('告警起始时间')).toBeInTheDocument();
|
||||
expect(within(dialog).getByLabelText('告警结束时间')).toBeInTheDocument();
|
||||
fireEvent.click(within(dialog).getByRole('combobox', { name: '协议' }));
|
||||
fireEvent.click(await screen.findByText('JT808'));
|
||||
fireEvent.click(within(dialog).getByRole('button', { name: '应用并查询' }));
|
||||
|
||||
await waitFor(() => expect(mocks.alertEventsV2).toHaveBeenLastCalledWith(expect.objectContaining({ protocol: 'JT808' }), expect.anything()));
|
||||
expect(screen.getByRole('button', { name: /修改事件筛选:已启用 1 项/ })).toHaveAttribute('aria-expanded', 'false');
|
||||
});
|
||||
|
||||
test('keeps mobile rule selection focused and opens editing in a Semi bottom SideSheet', async () => {
|
||||
|
||||
Reference in New Issue
Block a user