Public: anyone can read this; the crew can change it.
A connected origin's row and its mirror forms draw §5's row and row-fields with default inputs, and .origin-*, .mirror-form leave the markup #4256
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/4223-a-connected-origin-s-row-and-its-mirror → main 3 commits fork 1 thread · 1 unresolved
2 files
changed +30
−14
src/web/pages/origins.ts +2 −2
| @@ -1449,7 +1449,7 @@ export async function originReposPage(ctx: Ctx): Promise<Response> { | ||
| 1449 | 1449 | forkable, |
| 1450 | 1450 | () => |
| 1451 | 1451 | html`<form |
| 1452 | class="bar" | |
| 1452 | class="row-fields" | |
| 1453 | 1453 | method="post" |
| 1454 | 1454 | action="${browseBase(origin.id, remote.fullName)}/fork" |
| 1455 | 1455 | > |
| @@ -1471,7 +1471,7 @@ export async function originReposPage(ctx: Ctx): Promise<Response> { | ||
| 1471 | 1471 | })}` |
| 1472 | 1472 | : html`${counted}${forkForm} |
| 1473 | 1473 | <form |
| 1474 | class="bar" | |
| 1474 | class="row-fields" | |
| 1475 | 1475 | method="post" |
| 1476 | 1476 | action="/settings/origins/${origin.id}/mirror" |
| 1477 | 1477 | > |
test/web-origins.test.ts +28 −12
| @@ -294,19 +294,35 @@ describe("origins on the web", () => { | ||
| 294 | 294 | expect(html).not.toContain("Mirror all"); |
| 295 | 295 | }); |
| 296 | 296 | |
| 297 | test("the origin row and the mirror forms use the shared row, bar and btn, not the page-local names", async () => { | |
| 297 | test("the origin row and the mirror forms are drawn with the design's row and default inputs", async () => { | |
| 298 | const id = listOrigins(app.db, getUserByName(app.db, "alice")!.id)[0]!.id; | |
| 299 | const old = /origin-row|origin-name|origin-mark|mirror-form/; | |
| 300 | const card = await (await asUser(alice, "/settings/origins")).text(); | |
| 301 | expect(card).not.toMatch(old); | |
| 302 | expect(card).toContain('class="list setting-list"'); | |
| 303 | expect(card).toContain("personal access token"); | |
| 304 | expect(card).toContain(`action="/settings/origins/${id}/sync"`); | |
| 305 | expect(card).toContain(`href="/settings/origins/${id}/repos"`); | |
| 306 | expect(card).toContain(encodeURIComponent(`/settings/origins/${id}/delete`)); | |
| 307 | expect(card).toContain("Sync now"); | |
| 308 | expect(card).toContain("Repositories"); | |
| 309 | expect(card).toContain("Disconnect"); | |
| 310 | const html = await ( | |
| 311 | await asUser(alice, `/settings/origins/${id}/repos`) | |
| 312 | ).text(); | |
| 313 | expect(html).not.toMatch(old); | |
| 314 | expect(html).toContain('class="row-fields"'); | |
| 315 | expect(html).toContain(`action="/settings/origins/${id}/mirror"`); | |
| 316 | expect(html).toContain('name="fullName"'); | |
| 317 | expect(html).toContain("Mirror"); | |
| 318 | for (const page of [card, html]) | |
| 319 | for (const input of page.match(/<input\b[^>]*>/g) ?? []) | |
| 320 | expect(input).not.toContain("data-size"); | |
| 321 | }); | |
| 322 | ||
| 323 | test("a remote whose name is taken locally gets the labelled name box in a row-fields form", async () => { | |
| 298 | 324 | const id = listOrigins(app.db, getUserByName(app.db, "alice")!.id)[0]!.id; |
| 299 | 325 | const old = /origin-row|origin-name|origin-mark|mirror-form/; |
| 300 | const list = await (await asUser(alice, "/settings/origins")).text(); | |
| 301 | expect(list).not.toMatch(old); | |
| 302 | expect(list).toContain(`class="list setting-list"`); | |
| 303 | expect(list).toContain(`class="row"`); | |
| 304 | expect(list).toContain(`action="/settings/origins/${id}/sync"`); | |
| 305 | expect(list).toContain(`href="/settings/origins/${id}/repos"`); | |
| 306 | expect(list).toContain("Sync now"); | |
| 307 | expect(list).toContain("Repositories"); | |
| 308 | expect(list).toContain("Disconnect"); | |
| 309 | expect(list).toContain("personal access token"); | |
| 310 | 326 | // A remote whose name is already taken locally gets the labelled name box. |
| 311 | 327 | const alicia = getUserByName(app.db, "alice")!; |
| 312 | 328 | const taken = await createRepo(app, alicia, { |
| @@ -329,7 +345,7 @@ describe("origins on the web", () => { | ||
| 329 | 345 | // Refresh again so the cached repository list forgets the fixture. |
| 330 | 346 | await asUser(alice, `/settings/origins/${id}/repos?refresh=1`); |
| 331 | 347 | expect(picker).not.toMatch(old); |
| 332 | const mirrorForm = `<form[^>]*class="bar"[^>]*action="/settings/origins/${id}/mirror"`; | |
| 348 | const mirrorForm = `<form[^>]*class="row-fields"[^>]*action="/settings/origins/${id}/mirror"`; | |
| 333 | 349 | expect(picker).toMatch(new RegExp(mirrorForm)); |
| 334 | 350 | expect(picker).toContain('name="fullName"'); |
| 335 | 351 | expect(picker).toMatch( |
new above
offline