Rewrite the constraint specs and docs for the service-led information architecture.
Assertions now follow the eighteen prerenderable paths, the gist dialog, and the six-case evidence set. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -64,53 +64,44 @@ test.describe('keyboard and terminal dock', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('compact services submenu stays keyboard accessible at 1024px', async ({
|
||||
test('compact primary nav stays a single row without a services submenu', async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
test.skip(testInfo.project.name === 'mobile', 'compact submenu applies from md up');
|
||||
test.skip(testInfo.project.name === 'mobile', 'compact nav applies from md up');
|
||||
|
||||
await page.setViewportSize({ width: 1024, height: 900 });
|
||||
await page.goto('/');
|
||||
|
||||
const servicesParent = page.locator(
|
||||
`.primary-nav > li > a[href="${pagePath('services', 'de')}"]`,
|
||||
);
|
||||
const firstChild = page.locator(
|
||||
`.primary-nav > li > .submenu a[href="${pagePath('servicesSoftware', 'de')}"]`,
|
||||
);
|
||||
const services = page.locator(`.primary-nav > li > a[href="${pagePath('services', 'de')}"]`);
|
||||
await expect(services).toBeVisible();
|
||||
await expect(page.locator('.primary-nav .submenu')).toHaveCount(0);
|
||||
await expect(page.locator('.primary-nav a')).toHaveCount(5);
|
||||
|
||||
await servicesParent.focus();
|
||||
await expect(firstChild).toBeVisible();
|
||||
await page.keyboard.press('Tab');
|
||||
await expect(firstChild).toBeFocused();
|
||||
await services.click();
|
||||
await page.waitForURL('**/leistungen');
|
||||
await expect(services).toHaveAttribute('aria-current', 'page');
|
||||
|
||||
const headerBox = await page.locator('.site-header').boundingBox();
|
||||
expect(headerBox, 'header while submenu is open').toBeTruthy();
|
||||
expect(headerBox!.height, 'header height while submenu is open').toBeLessThanOrEqual(200);
|
||||
|
||||
const background = await firstChild.evaluate((element) => {
|
||||
const submenu = element.closest('.submenu');
|
||||
return submenu ? getComputedStyle(submenu).backgroundColor : '';
|
||||
});
|
||||
expect(background, 'submenu background must be fully opaque').toMatch(
|
||||
/^rgb\(\d+,\s*\d+,\s*\d+\)$/,
|
||||
const overflow = await page.evaluate(
|
||||
() => document.documentElement.scrollWidth <= window.innerWidth + 1,
|
||||
);
|
||||
expect(overflow, 'horizontal overflow at 1024px').toBe(true);
|
||||
});
|
||||
|
||||
test('terminal dock opens with Control+K without locking the page and restores on Escape', async ({
|
||||
test('terminal dock is open on load, does not lock the page, and restores on Escape', async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto('/');
|
||||
const trigger = page.locator('.terminal-dock-trigger');
|
||||
await trigger.focus();
|
||||
await page.keyboard.press('Control+k');
|
||||
|
||||
const panel = page.locator('.terminal-dock-panel');
|
||||
|
||||
await expect(panel).toBeVisible();
|
||||
await expect(trigger).toBeHidden();
|
||||
await expect(page.locator('#terminal-dock-input')).not.toBeFocused();
|
||||
await expect(page.locator('.site')).not.toHaveAttribute('inert');
|
||||
expect(await page.evaluate(() => document.body.style.overflow)).not.toBe('hidden');
|
||||
await expect(page.locator('[role="dialog"]')).toHaveCount(0);
|
||||
await expect(page.locator('.terminal-dock [role="dialog"]')).toHaveCount(0);
|
||||
|
||||
await page.locator('#terminal-dock-input').focus();
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(panel).toHaveCount(0);
|
||||
await expect(trigger).toBeFocused();
|
||||
|
||||
Reference in New Issue
Block a user