UI: tg-fullscreen header gap +10px (was +20) + font-scale regression test
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 39s
CI / gate (pull_request) Successful in 0s
CI / changes (pull_request) Successful in 1s
CI / unit (pull_request) Has been skipped
CI / deploy (pull_request) Successful in 55s
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 39s
CI / gate (pull_request) Successful in 0s
CI / changes (pull_request) Successful in 1s
CI / unit (pull_request) Has been skipped
CI / deploy (pull_request) Successful in 55s
The +20px gap was too far; use +10px (padding-top safe-top+16). The gap is fixed px, so the clearance from Telegram's native nav stays constant when the user scales the font up — the title grows downward and the bar with it, no overflow. Locked by a new e2e test that asserts the title top is unchanged across font sizes and never overflows the bar.
This commit is contained in:
@@ -35,6 +35,37 @@ test('Telegram launch auto-authenticates into the lobby and applies the theme',
|
||||
.toBe('#101418');
|
||||
});
|
||||
|
||||
test('tg-fullscreen header keeps a constant native-nav gap as the font scales', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await page.getByRole('button', { name: /guest/i }).click();
|
||||
await expect(page.getByText('Your turn')).toBeVisible(); // the lobby header is present + settled
|
||||
|
||||
// Emulate Telegram fullscreen: the class + safe-area vars our header positions against.
|
||||
await page.evaluate(() => {
|
||||
const h = document.documentElement;
|
||||
h.classList.add('tg-fullscreen');
|
||||
h.style.setProperty('--tg-safe-top', '47px');
|
||||
h.style.setProperty('--tg-content-top', '50px');
|
||||
});
|
||||
const probe = () =>
|
||||
page.evaluate(() => {
|
||||
const bar = document.querySelector('.bar')!.getBoundingClientRect();
|
||||
const h1 = document.querySelector('.bar h1')!.getBoundingClientRect();
|
||||
return { h1Top: Math.round(h1.top), overflows: h1.bottom > bar.bottom + 0.5 };
|
||||
});
|
||||
|
||||
const normal = await probe();
|
||||
// Scale the root font up (an OS / Telegram "larger text" setting scales rem-based text).
|
||||
await page.evaluate(() => (document.documentElement.style.fontSize = '28px'));
|
||||
const large = await probe();
|
||||
|
||||
// The gap to Telegram's native controls is a fixed px, so the title's top does not move…
|
||||
expect(large.h1Top).toBe(normal.h1Top);
|
||||
// …the title grows downward inside the bar (which grows with it), never overflowing it.
|
||||
expect(normal.overflows).toBe(false);
|
||||
expect(large.overflows).toBe(false);
|
||||
});
|
||||
|
||||
test('outside Telegram, the /telegram/ entry redirects to the site root', async ({ page }) => {
|
||||
await page.goto('/telegram/');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user