Public: anyone can read this; the crew can change it.
The apps and origins pages' filters draw §5's filters, and .filters leaves their markup #4344
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/4295-the-apps-and-origins-pages-filters-draw → main 5 commits fork 1 thread · 1 unresolved
4 files
changed +31
−2
src/web/pages/apps.ts +1 −1
| @@ -186,7 +186,7 @@ export async function appsList(ctx: Ctx): Promise<Response> { | ||
| 186 | 186 | const filters = |
| 187 | 187 | archivedView || entries.length === 0 |
| 188 | 188 | ? null |
| 189 | : html`<div class="filters mb"> | |
| 189 | : html`<div class="bar mb"> | |
| 190 | 190 | ${seg([ |
| 191 | 191 | { |
| 192 | 192 | label: "All", |
src/web/pages/origins.ts +1 −1
| @@ -1398,7 +1398,7 @@ export async function originReposPage(ctx: Ctx): Promise<Response> { | ||
| 1398 | 1398 | ) |
| 1399 | 1399 | : []; |
| 1400 | 1400 | |
| 1401 | const filter = html`<form class="filters" method="get" action="${base}"> | |
| 1401 | const filter = html`<form class="bar mb" method="get" action="${base}"> | |
| 1402 | 1402 | <input |
| 1403 | 1403 | class="input search" |
| 1404 | 1404 | type="search" |
test/apps-archived.test.ts +23
| @@ -62,6 +62,16 @@ const get = async (path: string) => { | ||
| 62 | 62 | return { status: res.status, body: await res.text() }; |
| 63 | 63 | }; |
| 64 | 64 | |
| 65 | test("the All/Live filter draws the bar, not .filters, and keeps its links and current mark", async () => { | |
| 66 | const page = (await get("/apps")).body; | |
| 67 | expect(page).not.toContain("filters"); | |
| 68 | expect(page).toContain('<div class="bar mb">'); | |
| 69 | expect(page).toContain('href="/apps?live=1"'); | |
| 70 | const live = (await get("/apps?live=1")).body; | |
| 71 | expect(live).not.toContain("filters"); | |
| 72 | expect(live).toContain('aria-current'); | |
| 73 | }); | |
| 74 | ||
| 65 | 75 | test("archiving hides an app from /apps, lists it at ?archived=1, and waking brings it back", async () => { |
| 66 | 76 | let page = await get("/apps"); |
| 67 | 77 | expect(page.body).toContain(ROW_KEEPER); |
| @@ -108,3 +118,16 @@ test("a signed-out viewer does not see a private archived app", async () => { | ||
| 108 | 118 | expect(anon).not.toContain("/alice/secret"); |
| 109 | 119 | expect((await get("/apps?archived=1")).body).toContain("/alice/secret"); |
| 110 | 120 | }); |
| 121 | ||
| 122 | test("the stylesheet sizes .search and .seg inside .bar, without needing .filters", async () => { | |
| 123 | const { content } = await import("../src/web/style/content.ts"); | |
| 124 | expect(content).toMatch(/^\.bar \.search \{[^}]*min-width: 180px[^}]*max-width: 320px/m); | |
| 125 | expect(content).toMatch(/^\.bar \.seg \{[^}]*overflow-x: auto/m); | |
| 126 | expect(content).toMatch(/\.bar \.seg > a \{ padding: 0 8px/); | |
| 127 | }); | |
| 128 | ||
| 129 | test("the stylesheet carries no merge-conflict markers", async () => { | |
| 130 | const { content } = await import("../src/web/style/content.ts"); | |
| 131 | expect(content).not.toMatch(/^(<<<<<<<|=======|>>>>>>>)/m); | |
| 132 | expect(content).toContain("The same three reaches for a filter bar drawn with §5's .bar."); | |
| 133 | }); |
test/web-origins.test.ts +6
| @@ -387,6 +387,12 @@ describe("origins on the web", () => { | ||
| 387 | 387 | // Refresh again so the cached repository list forgets the fixture. |
| 388 | 388 | await asUser(alice, `/settings/origins/${id}/repos?refresh=1`); |
| 389 | 389 | expect(picker).not.toMatch(old); |
| 390 | expect(picker).not.toContain("filters"); | |
| 391 | expect(picker).toMatch( | |
| 392 | new RegExp(`<form class="bar mb" method="get" action="/settings/origins/${id}/repos">`), | |
| 393 | ); | |
| 394 | expect(picker).toContain('name="q"'); | |
| 395 | expect(picker).toContain("Refresh from origin"); | |
| 390 | 396 | const mirrorForm = `<form[^>]*class="row-fields"[^>]*action="/settings/origins/${id}/mirror"`; |
| 391 | 397 | expect(picker).toMatch(new RegExp(mirrorForm)); |
| 392 | 398 | expect(picker).toContain('name="fullName"'); |
new above
offline