test: align navigation and sign label checks with the gantry

This commit is contained in:
2026-10-11 00:07:09 +03:00
parent ea2bf02222
commit 10b867143b
2 changed files with 30 additions and 8 deletions

View File

@@ -8,8 +8,11 @@ test('desktop navigation docks without stretching labels or shifting the documen
await page.evaluate(() => document.fonts.ready);
const nav = page.locator('.site-navigation');
await expect(nav).toHaveAttribute('data-enhanced', 'true');
// Since round 5 the bar is a full-bleed overhead gantry: it is docked at
// the top and unscaled from the first frame instead of growing into place.
const surfaceScale = () => nav.evaluate(el => new DOMMatrixReadOnly(getComputedStyle(el, '::before').transform).a);
expect(await surfaceScale()).toBeLessThan(1);
expect(await surfaceScale()).toBe(1);
expect((await nav.boundingBox())!.y).toBeLessThan(1);
const label = nav.locator('a').first();
const initialFont = await label.evaluate(el => getComputedStyle(el).fontSize);
// Measure the content beside this fixed header, not unrelated lazy media
@@ -26,7 +29,7 @@ test('desktop navigation docks without stretching labels or shifting the documen
expect(await label.evaluate(el => getComputedStyle(el).fontSize)).toBe(initialFont);
expect(await heroGeometry()).toEqual(initialHero);
await page.evaluate(() => scrollTo(0, 0));
await expect.poll(async () => (await nav.boundingBox())!.y).toBeGreaterThan(10);
await expect.poll(async () => (await nav.boundingBox())!.y).toBeLessThan(1);
});
test('selected navigation has rounded inset highlights', async ({ page, distUrl }) => {
@@ -34,7 +37,16 @@ test('selected navigation has rounded inset highlights', async ({ page, distUrl
const disclosure = page.locator('.site-navigation summary');
if (await disclosure.isVisible()) await disclosure.click();
const selected = page.locator('.site-navigation a[aria-current="page"]');
expect(await selected.evaluate(el => parseFloat(getComputedStyle(el).borderTopLeftRadius))).toBeGreaterThanOrEqual(5);
// On the desktop gantry the current exit is marked by its amber lane lamp
// (the li::after rule) rather than a rounded inset; the menu keeps the inset.
const marker = await selected.evaluate(el => {
const lamp = getComputedStyle(el.parentElement!, '::after');
return {
radius: parseFloat(getComputedStyle(el).borderTopLeftRadius),
lamp: lamp.content !== 'none' && parseFloat(lamp.blockSize) >= 2,
};
});
expect(marker.radius >= 5 || marker.lamp).toBe(true);
await selected.focus();
await page.keyboard.press('Shift');
expect(await selected.evaluate(el => getComputedStyle(el).outlineStyle)).not.toBe('none');