The tab's icon follows light and dark mode (#64)
The logo on the page switched with the mode (#63), but the tab's icon was always favicon.png, the light logo. web/favicon-dark.png is logo-dark.svg at 128px, served beside it, and the theme script points the icon link at whichever matches data-mode, so it follows the theme the account chose, not only the system. The sign-in page, with no account, picks by the system's with two media-bound links. /favicon.ico, which a browser asks for on its own, stays the light one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1193,9 +1193,12 @@ test('the logo is the dark one in dark mode and the light one in light mode', as
|
||||
});
|
||||
|
||||
test('the favicon is the logo, square, from both pages', async ({ page }) => {
|
||||
await expect(page.locator('link[rel="icon"]')).toHaveAttribute('href', /^\/favicon\.png\?v=[0-9a-f]{12}$/);
|
||||
await page.evaluate(() => setTheme('modern', 'light'));
|
||||
await expect(page.locator('#favicon')).toHaveAttribute('href', /^\/favicon\.png\?v=[0-9a-f]{12}$/);
|
||||
await page.evaluate(() => setTheme('modern', 'dark'));
|
||||
await expect(page.locator('#favicon')).toHaveAttribute('href', /^\/favicon-dark\.png\?v=[0-9a-f]{12}$/);
|
||||
// A browser asks for /favicon.ico on its own, signed in or not.
|
||||
for (const path of ['/favicon.ico', '/favicon.png', '/apple-touch-icon.png']) {
|
||||
for (const path of ['/favicon.ico', '/favicon.png', '/favicon-dark.png', '/apple-touch-icon.png']) {
|
||||
const r = await page.request.get(path, { headers: { cookie: '' } });
|
||||
expect(r.status(), path).toBe(200);
|
||||
expect(r.headers()['content-type'], path).toBe('image/png');
|
||||
|
||||
Reference in New Issue
Block a user