frontend: find bar project filter is an All projects / All units select pair (#40)
The find bar reused the New Packet two-step picker, which put a project search and a list of project cards inside the bar. It now has two selects like the old build: All projects or one active project, then All units or one of its units. A saved pick no longer in the active list still shows. Closes #40 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -64,9 +64,8 @@ export const L = {
|
||||
find: {
|
||||
bar: "findbar", // data-testid of the bar (a region named "Find jobs")
|
||||
search: "Find a job",
|
||||
project: "Project", // the project search box of PickUnit
|
||||
projectsFound: "Projects found",
|
||||
change: "Change",
|
||||
project: "Project", // the project select (ProjectUnitSelect)
|
||||
allProjects: "All projects",
|
||||
unit: "Unit",
|
||||
filters: "Filters",
|
||||
board: "Board",
|
||||
@@ -293,24 +292,18 @@ export function searchBox(page: Page): Locator {
|
||||
return findBar(page).getByRole("searchbox", { name: L.find.search });
|
||||
}
|
||||
|
||||
/** Pick a project in the find bar (PickUnit: search, then the hit). Unpicks the current one first. */
|
||||
/** Pick a project in the find bar: the Project select, by its number. */
|
||||
export async function pickProject(page: Page, number: string): Promise<void> {
|
||||
const bar = findBar(page);
|
||||
const change = bar.getByRole("button", { name: L.find.change, exact: true });
|
||||
if (await change.count()) await change.first().click();
|
||||
await bar.getByRole("searchbox", { name: L.find.project }).fill(number);
|
||||
await bar
|
||||
.getByRole("group", { name: L.find.projectsFound })
|
||||
.getByRole("button", { name: new RegExp(`^${number}\\b`) })
|
||||
.first()
|
||||
.click();
|
||||
await expect(bar.getByText(number, { exact: true }).first()).toBeVisible();
|
||||
const sel = findBar(page).getByRole("combobox", { name: L.find.project, exact: true });
|
||||
const opt = sel.locator("option").filter({ hasText: new RegExp(`^${number}( · |$)`) }).first();
|
||||
await expect(opt).toBeAttached();
|
||||
await sel.selectOption((await opt.getAttribute("value")) ?? "");
|
||||
await expect(sel).not.toHaveValue("");
|
||||
}
|
||||
|
||||
/** Back to every project. */
|
||||
export async function unpickProject(page: Page): Promise<void> {
|
||||
const change = findBar(page).getByRole("button", { name: L.find.change, exact: true });
|
||||
if (await change.count()) await change.first().click();
|
||||
await findBar(page).getByRole("combobox", { name: L.find.project, exact: true }).selectOption({ label: L.find.allProjects });
|
||||
}
|
||||
|
||||
/** The n of "Showing n packets". */
|
||||
|
||||
Reference in New Issue
Block a user