Organize settings into searchable sections with responsive navigation

This commit is contained in:
Jonathan Sykes
2026-10-03 14:42:39 +08:00
parent 264bb26a36
commit 09ae6a2a85
8 changed files with 193 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
const { test, expect } = require('@playwright/test');
const { openClassic } = require('./helpers/classic-fixture');
for (const layout of ['classic', 'glass-stage']) for (const width of [390, 1440]) {
test(`${layout} settings navigation at ${width}px`, async ({ page }) => {
await page.setViewportSize({ width, height: 900 }); await openClassic(page);
await page.evaluate(layout => { data.settings.layout = layout; applyAppearance(); view = { type: 'settings' }; render(); }, layout);
await expect(page.locator('.settings-section-row').first()).toBeVisible();
await expect(page.locator('#setQuality')).toHaveCount(1);
if (width === 390) await expect(page.locator('#setQuality')).toBeHidden();
await page.locator('.settings-search input').fill('default quality');
await page.locator('.settings-results button').first().click();
await expect(page.locator('#setQuality')).toBeVisible();
await page.locator('#setQuality').selectOption('720p');
expect(await page.evaluate(() => data.settings.quality)).toBe('720p');
if (width === 390) { await page.goBack(); await expect(page.locator('.settings-overview')).toBeVisible(); await expect(page.locator('#setQuality')).toBeHidden(); }
await page.locator('.settings-section-row[data-section="appearance"]').click();
await expect(page.locator('#setTheme')).toBeVisible();
await page.locator('#setTheme').selectOption('light');
expect(await page.evaluate(() => data.settings.theme)).toBe('light');
await expect(page.locator('#setQuality')).toHaveValue('720p');
expect(await page.evaluate(() => sessionStorage.getItem('ytpSettingsSection'))).toBe('appearance');
const overflow = await page.locator('.settings-browser').evaluate(el => el.scrollWidth > el.clientWidth + 1); expect(overflow).toBe(false);
});
}