feat: click off sidebar on small windows closes it
This commit is contained in:
parent
62b0efac04
commit
1206e211d5
2 changed files with 13 additions and 1 deletions
|
|
@ -99,3 +99,15 @@ test('contact list scrolls (independently) to current contact in center of view'
|
||||||
// roughly centered is fine, not that fussy about headers and whatnot
|
// roughly centered is fine, not that fussy about headers and whatnot
|
||||||
expect(Math.abs(linkPos - (await page.evaluate('window.innerHeight/2') as number))).toBeLessThan(200);
|
expect(Math.abs(linkPos - (await page.evaluate('window.innerHeight/2') as number))).toBeLessThan(200);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('clicking off contact list when expanded closes it', async ({ page }) => {
|
||||||
|
await page.setViewportSize({
|
||||||
|
width: 640,
|
||||||
|
height: 1000,
|
||||||
|
});
|
||||||
|
// TODO aria-label
|
||||||
|
await page.locator('#sidebar-show-hide').click();
|
||||||
|
await expect(page.getByRole('button', { name: /add contact/i })).toBeVisible();
|
||||||
|
await page.mouse.click(600, 500);
|
||||||
|
await expect(page.getByRole('button', { name: /add contact/i })).not.toBeVisible();
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ impl Layout {
|
||||||
a href="/logout" { "Logout" }
|
a href="/logout" { "Logout" }
|
||||||
}
|
}
|
||||||
section #content {
|
section #content {
|
||||||
nav #contacts-sidebar x-bind:class="sidebar ? 'show' : 'hide'" {
|
nav #contacts-sidebar x-bind:class="sidebar ? 'show' : 'hide'" "x-on:click.self"="sidebar = !sidebar" {
|
||||||
ul {
|
ul {
|
||||||
li { button hx-post="/contact/new" { "+ Add Contact" } }
|
li { button hx-post="/contact/new" { "+ Add Contact" } }
|
||||||
@for link in &self.contact_links {
|
@for link in &self.contact_links {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue