fix(ui): ensures admin.disableListFilter is disabled despite url search params (#9874)

Continuation of #9846 and partial fix for #9774. When setting
`admin.disableListFilter` retroactively, it remains active within the
list filter controls. Same for when the URL search query contains one of
these fields, except this will actually display the _wrong_ field,
falling back to the _first_ field from the config. The fix is to
properly disable the condition for this field if it's an active filter,
while still preventing it from ever rendering as an option within the
field selector itself.
This commit is contained in:
Jacob Fletcher
2024-12-10 17:37:52 -05:00
committed by GitHub
parent f7172b5b2c
commit da6bc55b19
12 changed files with 147 additions and 66 deletions

View File

@@ -0,0 +1,26 @@
import type { Page } from '@playwright/test'
import { expect } from '@playwright/test'
export const openListColumns = async (
page: Page,
{
togglerSelector = '.list-controls__toggle-columns',
columnContainerSelector = '.list-controls__columns',
}: {
columnContainerSelector?: string
togglerSelector?: string
},
): Promise<any> => {
const columnContainer = page.locator(columnContainerSelector).first()
const isAlreadyOpen = await columnContainer.isVisible()
if (!isAlreadyOpen) {
await page.locator(togglerSelector).first().click()
}
await expect(page.locator(`${columnContainerSelector}.rah-static--height-auto`)).toBeVisible()
return columnContainer
}

View File

@@ -0,0 +1,26 @@
import type { Page } from '@playwright/test'
import { expect } from '@playwright/test'
export const openListFilters = async (
page: Page,
{
togglerSelector = '.list-controls__toggle-where',
filterContainerSelector = '.list-controls__where',
}: {
filterContainerSelector?: string
togglerSelector?: string
},
) => {
const columnContainer = page.locator(filterContainerSelector).first()
const isAlreadyOpen = await columnContainer.isVisible()
if (!isAlreadyOpen) {
await page.locator(togglerSelector).first().click()
}
await expect(page.locator(`${filterContainerSelector}.rah-static--height-auto`)).toBeVisible()
return columnContainer
}

View File

@@ -3,28 +3,7 @@ import type { Page } from '@playwright/test'
import { expect } from '@playwright/test'
import { exactText } from '../../helpers.js'
export const openListColumns = async (
page: Page,
{
togglerSelector = '.list-controls__toggle-columns',
columnContainerSelector = '.list-controls__columns',
}: {
columnContainerSelector?: string
togglerSelector?: string
},
): Promise<any> => {
const columnContainer = page.locator(columnContainerSelector).first()
const isAlreadyOpen = await columnContainer.isVisible()
if (!isAlreadyOpen) {
await page.locator(togglerSelector).first().click()
}
await expect(page.locator(`${columnContainerSelector}.rah-static--height-auto`)).toBeVisible()
return columnContainer
}
import { openListColumns } from './openListColumns.js'
export const toggleColumn = async (
page: Page,