Improve mobile sidebar UX

This commit is contained in:
thePR0M3TH3AN
2025-07-10 16:25:32 -04:00
parent a8982d9047
commit ebe5ab7516
4 changed files with 46 additions and 1 deletions

View File

@@ -100,6 +100,19 @@ test('sidebar opens on small screens', async () => {
expect(sidebarLeft).toBe('0px');
});
test('clicking outside closes sidebar on small screens', async () => {
const page = await browser.newPage();
await page.setViewport({ width: 500, height: 800 });
await page.goto(`http://localhost:${port}/`);
await page.waitForSelector('#sidebar-toggle');
await page.click('#sidebar-toggle');
await new Promise(r => setTimeout(r, 300));
await page.click('main');
await new Promise(r => setTimeout(r, 300));
const bodyClass = await page.evaluate(() => document.body.classList.contains('sidebar-open'));
expect(bodyClass).toBe(false);
});
test('sidebar toggles on large screens', async () => {
const page = await browser.newPage();
await page.setViewport({ width: 1024, height: 800 });