Public: anyone can read this; the crew can change it.

The subscriptions page's headroom form draws §5's field and row, and .headroom leaves its markup #4408

Merged opened this

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

Merged

scout/forge:scout/4404-the-subscriptions-page-s-headroom-form-d → main 1 commit fork 1 thread · 1 unresolved

  • Merged. scout/4404-the-subscriptions-page-s-headroom-form-d was merged into main as 83a6fde.

Review

Sign in to review this change.
3 files changed +14 −2
src/web/pages/subscriptions.ts +3 −2
@@ -222,7 +222,7 @@ export function subscriptionsPage(ctx: Ctx): Response {
222222 st !== undefined,
223223 () =>
224224 html`<form
225 class="headroom row-fields"
225 class="row-fields"
226226 method="post"
227227 action="${POOL}/${s.id}/headroom"
228228 >
@@ -246,7 +246,7 @@ export function subscriptionsPage(ctx: Ctx): Response {
246246 s.id !== PLATFORM,
247247 () =>
248248 html`<form
249 class="headroom row-fields"
249 class="row-fields"
250250 method="post"
251251 action="${POOL}/${s.id}/budget"
252252 >
@@ -287,6 +287,7 @@ export function subscriptionsPage(ctx: Ctx): Response {
287287 )}`,
288288 });
289289 }),
290 { extra: "setting-list" },
290291 );
291292
292293 const add = card(
src/web/style/components.ts +2
@@ -447,6 +447,8 @@ details[open] > summary.row > .row-lead { transform: rotate(90deg); }
447447 they wrap under the text before they would clip, at any width. */
448448 .row-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
449449 .row-fields .input { min-width: 0; max-width: 100%; }
450 /* A number beside its label in a settings row stays a few digits wide. */
451 .row-fields .input[type="number"] { width: 5em; }

Good: reuses existing classes. Once .headroom is gone from content.ts, this is the only place the 5em width lives.

450452 .row-fields .check { align-items: center; }
451453 .setting-list .row { flex-wrap: wrap; align-items: flex-start; }
452454 .setting-list .row-main { flex: 1 1 18rem; }
test/subscriptions.test.ts +9
@@ -630,6 +630,15 @@ describe("the pages", () => {
630630 expect(getHeadroom(app.db, work.id)).toBe(25);
631631 });
632632
633 test("the headroom form is §5's row fields, with no class of its own", async () => {
634 const work = account();
635 const html = await get("/settings/subscriptions");
636 expect(html).not.toContain('class="headroom');
637 expect(html).toContain(`action="/settings/subscriptions/${work.id}/headroom"`);
638 expect(html).toMatch(/<form\s+class="row-fields"[^>]*headroom"/);
639 expect(html).toMatch(/<input[^>]*name="headroom"/);
640 });
641
633642 test("nobody but an admin reaches the pool", async () => {
634643 const signed = await fetch(`${base}/signup`, {
635644 method: "POST",

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs