fix: restore signs after navigation
This commit is contained in:
@@ -163,6 +163,36 @@ test('suppresses roadside signs for explicit navigation and history restoration'
|
||||
expect((await readSceneInstrumentation(page)).routeLabelsDrawn).toEqual([]);
|
||||
});
|
||||
|
||||
test('restores the next sign after a navigator round trip', async ({
|
||||
page,
|
||||
distUrl,
|
||||
}) => {
|
||||
await page.goto(distUrl, { waitUntil: 'domcontentloaded' });
|
||||
await expect(page.locator('.journey-world')).toHaveAttribute('data-scene-state', 'running');
|
||||
|
||||
await clickNavigationLink(page, '#profile');
|
||||
await expect(page.locator('#profile-heading')).toBeFocused();
|
||||
await clickNavigationLink(page, '#start');
|
||||
await expect(page.locator('#start-heading')).toBeFocused();
|
||||
|
||||
const destination = await page.evaluate(() => {
|
||||
const profile = document.getElementById('profile-heading');
|
||||
if (!(profile instanceof HTMLElement)) throw new Error('Missing profile heading');
|
||||
const viewportHeight = window.visualViewport?.height ?? window.innerHeight;
|
||||
return Math.max(
|
||||
1,
|
||||
profile.getBoundingClientRect().top + window.scrollY
|
||||
- viewportHeight * (0.35 + 0.45),
|
||||
);
|
||||
});
|
||||
await page.mouse.wheel(0, 1);
|
||||
await page.evaluate((scrollY) => window.scrollTo(0, scrollY), destination);
|
||||
|
||||
await expect.poll(async () => (
|
||||
await readSceneInstrumentation(page)
|
||||
).signFrames.some((frame) => frame.targetId === 'profile')).toBe(true);
|
||||
});
|
||||
|
||||
test('reconciles an idle rapid jump to the latest active route without flashing intermediates', async ({
|
||||
page,
|
||||
distUrl,
|
||||
|
||||
Reference in New Issue
Block a user