fix(web): activate contextual help and filter status
This commit is contained in:
@@ -41,3 +41,19 @@ test('reschedules likely route preloads when the active module changes', async (
|
||||
cleanup();
|
||||
expect(secondCleanup).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test('opens contextual help for the active module and closes it without navigating', () => {
|
||||
render(<MemoryRouter future={ROUTER_FUTURE} initialEntries={['/monitor']}>
|
||||
<Routes><Route element={<AppShell />}><Route path="*" element={<span>页面内容</span>} /></Route></Routes>
|
||||
</MemoryRouter>);
|
||||
|
||||
const help = screen.getByRole('button', { name: '帮助' });
|
||||
expect(help).toHaveAttribute('aria-expanded', 'false');
|
||||
fireEvent.click(help);
|
||||
|
||||
expect(screen.getByRole('dialog', { name: '全局监控' })).toHaveTextContent('筛选会自动生效');
|
||||
expect(help).toHaveAttribute('aria-expanded', 'true');
|
||||
fireEvent.click(screen.getByRole('button', { name: '关闭帮助' }));
|
||||
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
||||
expect(screen.getByText('页面内容')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user