fix(app): closed filters panel has no height; e2e asserts it at 375 px

This commit is contained in:
bchanot committed 2026-11-16 20:47:34 +01:00
1 parent ca701787ce
commit a50796b89f
2 files changed
+14 -6

No files matched your search

+8 -3
View File
@@ -313,6 +313,9 @@ async function checkClosedFilters(page: Page, dict: Dict) {
await expect(searchField(page, dict)).toBeVisible()
await expect(page.getByLabel(dict['admin.sheets.sort_by'])).toBeVisible()
await expect(filterSelect(page, dict, 'species')).toBeHidden()
await expect(countLine(page)).toBeVisible()
const box = await page.locator('#admin-sheets-filters').boundingBox()
expect(box?.height, 'the closed panel takes no height').toBeLessThanOrEqual(1)
await toggle.focus()
await page.keyboard.press('Tab')
const inPanel = await page.evaluate(() =>
@@ -322,9 +325,11 @@ async function checkClosedFilters(page: Page, dict: Dict) {
}
/** Phone: open, filter, count on the button, close keeps them, reset. */
async function checkPhoneFilters(page: Page, dict: Dict) {
async function checkPhoneFilters(page: Page, dict: Dict, token: string) {
const toggle = filtersToggle(page, dict)
await checkClosedFilters(page, dict)
// The sandbox list is long: narrow it to this run's sheets before axe scans the page.
await searchField(page, dict).fill(token)
await toggle.click()
await expect(toggle).toHaveAttribute('aria-expanded', 'true')
for (const key of [
@@ -428,13 +433,13 @@ test.describe('official sheet list: search, sort and dates (R3)', () => {
page,
}) => {
test.setTimeout(240_000)
const { actor } = fixtures!
const { actor, token } = fixtures!
await openAdmin(page, dict, locale, actor)
await page.goto('/app/admin/sheets')
await expect(heading(page, dict['admin.sheets.title'])).toBeVisible()
const width = page.viewportSize()?.width ?? 0
if (width > PHONE_MAX_WIDTH) return checkDesktopFilters(page, dict)
await checkPhoneFilters(page, dict)
await checkPhoneFilters(page, dict, token)
})
})
}
@@ -376,9 +376,12 @@ function Filters(props: ResultsProps) {
data-open={view.open}
className={`${PANEL} ${state}`}
>
<div className="-m-1 min-h-0 overflow-hidden p-1 max-sm:pt-4 sm:overflow-visible">
<FilterGrid {...props} />
<ResetFilters view={view} />
<div className="-m-1 min-h-0 overflow-hidden p-1 sm:overflow-visible">
{/* the top spacing is content: a closed 0fr row clips it, padding would stay */}
<div className="max-sm:pt-3">
<FilterGrid {...props} />
<ResetFilters view={view} />
</div>
</div>
</div>
</div>