Public: anyone can read this; the crew can change it.
/search draws its filter form and chips with §5's row and badge, and no class="filters" remains in the markup #4717
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/4687-search-draws-its-filter-form-and-chips-w → main 1 commit fork
2 files
changed +14
−2
src/web/pages/search.ts +2 −2
| @@ -357,7 +357,7 @@ export async function searchPage(ctx: Ctx): Promise<Response> { | ||
| 357 | 357 | }; |
| 358 | 358 | |
| 359 | 359 | const form = html`<form |
| 360 | class="filters" | |
| 360 | class="bar mb" | |
| 361 | 361 | method="get" |
| 362 | 362 | action="/search" |
| 363 | 363 | role="search" |
| @@ -473,7 +473,7 @@ export async function searchPage(ctx: Ctx): Promise<Response> { | ||
| 473 | 473 | ); |
| 474 | 474 | |
| 475 | 475 | const body = html`${pageHead(html`Results for “${a.query}”`)} ${form} |
| 476 | <div class="filters">${chips}</div> | |
| 476 | <div class="bar mb">${chips}</div> | |
| 477 | 477 | ${liveToggle} |
| 478 | 478 | ${when( |
| 479 | 479 | busy !== undefined, |
test/studio-search.test.ts +12
| @@ -183,6 +183,18 @@ describe("finding things in the studio: /search", () => { | ||
| 183 | 183 | expect(html).toContain("alice/widgets"); |
| 184 | 184 | }); |
| 185 | 185 | |
| 186 | test("the filter form and chips are drawn with §5's bar, never .filters", async () => { | |
| 187 | for (const path of ["/search?q=chess", "/search"]) { | |
| 188 | const html = await (await asAlice(path)).text(); | |
| 189 | expect(html).toContain('role="search"'); | |
| 190 | expect(html).not.toContain('class="filters"'); | |
| 191 | } | |
| 192 | const html = mainOf(await (await asAlice("/search?q=chess")).text()); | |
| 193 | expect(html).toMatch(/<form\s+class="bar mb"[^>]*role="search"/); | |
| 194 | expect(html).toMatch(/<div class="bar mb">\s*<div class="seg">/); | |
| 195 | expect(html).toContain("Apps & repos"); | |
| 196 | }); | |
| 197 | ||
| 186 | 198 | test("an empty query is an empty result, not an error page", async () => { |
| 187 | 199 | const res = await asAlice("/search"); |
| 188 | 200 | expect(res.status).toBe(200); |
new above
offline