microsoft/hve-core

Public

mirrored fromhttps://github.com/microsoft/hve-coreAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/docs-update-scripts-linting-readme

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

docs/docusaurus/e2e/mobile-menu.spec.ts

28lines · modecode

1import { test, expect } from '@playwright/test';
2import AxeBuilder from '@axe-core/playwright';
3
4const WCAG_TAGS = ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'];
5
6// WCAG 2.1.2 No Keyboard Trap: the mobile navigation menu must open, expose its
7// contents to assistive tech, and remain operable in its expanded state.
8test.use({ viewport: { width: 390, height: 844 } });
9
10test.describe('Mobile navigation menu', () => {
11 test('toggle opens the sidebar and the opened state passes an axe scan', async ({ page }) => {
12 await page.goto('/hve-core/docs/getting-started/');
13
14 const toggle = page.locator('.navbar__toggle');
15 await expect(toggle).toBeVisible();
16
17 await toggle.click();
18
19 const mobileSidebar = page.locator('.navbar-sidebar');
20 await expect(mobileSidebar).toBeVisible();
21
22 const results = await new AxeBuilder({ page })
23 .withTags(WCAG_TAGS)
24 .include('.navbar-sidebar')
25 .analyze();
26 expect(results.violations).toEqual([]);
27 });
28});
29