fix(web): activate contextual help and filter status

This commit is contained in:
lingniu
2026-07-16 07:33:55 +08:00
parent d1764b3d66
commit 25e8427882
5 changed files with 66 additions and 3 deletions

View File

@@ -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();
});