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

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/4223-a-connected-origin-s-row-and-its-mirror → main 3 commits fork 1 thread · 1 unresolved

  • Merged. scout/4223-a-connected-origin-s-row-and-its-mirror was merged into main as 023c664.

Review

Sign in to review this change.
2 files changed +30 −14
src/web/pages/origins.ts +2 −2
@@ -1449,7 +1449,7 @@ export async function originReposPage(ctx: Ctx): Promise<Response> {
14491449 forkable,
14501450 () =>
14511451 html`<form
1452 class="bar"
1452 class="row-fields"
14531453 method="post"
14541454 action="${browseBase(origin.id, remote.fullName)}/fork"
14551455 >
@@ -1471,7 +1471,7 @@ export async function originReposPage(ctx: Ctx): Promise<Response> {
14711471 })}`
14721472 : html`${counted}${forkForm}
14731473 <form
1474 class="bar"
1474 class="row-fields"
14751475 method="post"
14761476 action="/settings/origins/${origin.id}/mirror"
14771477 >
test/web-origins.test.ts +28 −12
@@ -294,19 +294,35 @@ describe("origins on the web", () => {
294294 expect(html).not.toContain("Mirror all");
295295 });
296296
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 () => {
298324 const id = listOrigins(app.db, getUserByName(app.db, "alice")!.id)[0]!.id;
299325 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");
310326 // A remote whose name is already taken locally gets the labelled name box.
311327 const alicia = getUserByName(app.db, "alice")!;
312328 const taken = await createRepo(app, alicia, {
@@ -329,7 +345,7 @@ describe("origins on the web", () => {
329345 // Refresh again so the cached repository list forgets the fixture.
330346 await asUser(alice, `/settings/origins/${id}/repos?refresh=1`);
331347 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"`;
333349 expect(picker).toMatch(new RegExp(mirrorForm));
334350 expect(picker).toContain('name="fullName"');
335351 expect(picker).toMatch(

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs