Public: anyone can read this; the crew can change it.
Design: the inbox's ask cards draw §5's card and buttons, and the ask-* classes leave §5d #4368
mason/forge:mason/4083-design-the-inbox-s-ask-cards-draw-5-s-ca → main 11 commits fork
5 files
changed +124
−65
docs/DESIGN.md +5
| @@ -399,8 +399,13 @@ gone, so this list only shrinks. | ||
| 399 | 399 | - **`style/content.ts`, code view** — the source view and the syntax-highlight token classes `highlight-html.ts` builds as `tok-${kind}`: `.blob-view` `.ln` `.tok-attribute` `.tok-comment` `.tok-constant` `.tok-decorator` `.tok-deleted` `.tok-emphasis` `.tok-function` `.tok-heading` `.tok-inserted` `.tok-keyword` `.tok-link` `.tok-meta` `.tok-number` `.tok-operator` `.tok-plain` `.tok-property` `.tok-punctuation` `.tok-regex` `.tok-string` `.tok-tag` `.tok-type` `.tok-variable` |
| 400 | 400 | - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r` |
| 401 | 401 | - **`style/content.ts`, diff viewer** — the diff table: its gutters, line kinds, file head and inline review comments: `.add` `.del` `.dh` `.diff` `.diff-body` `.diff-head` `.diff-note` `.diff-path` `.diff-stat` `.diff-stub` `.diff-summary` `.diff-table` `.dl` `.dl-review` `.dn` `.dn-comment` `.nonl` `.rc-hidden` `.rc-resolve` `.rc-resolved` `.wd` |
| 402 | <<<<<<< HEAD | |
| 403 | - **`style/content.ts`, apps, runs, and the crew** — run pages, their logs and checks (a pull's look is §5's **look**): `.ln-forge` `.ln-pulse` `.ln-say` `.ln-tool` `.ln-you` `.pinned-failures` `.pinned-slot` `.txt` `.who` | |
| 404 | - **`style/content.ts`, search results** — search results; the inbox's ask cards are §5 cards marked `data-ask` in `#needs-you`: `.live-toggle` | |
| 405 | ======= | |
| 402 | 406 | - **`style/content.ts`, apps, runs, and the crew** — run pages, their logs and checks (a pull's look is §5's **look**): `.ln-forge` `.ln-pulse` `.ln-say` `.ln-tool` `.ln-you` `.txt` `.who` |
| 403 | 407 | - **`style/content.ts`, search results** — search results, the inbox's ask cards: `.ask-acts` `.ask-card` `.ask-group` `.ask-kind` `.ask-meta` `.ask-more-acts` `.ask-pick` `.ask-pick-hit` `.ask-short` `.ask-waiting` `.live-toggle` |
| 408 | >>>>>>> origin/main | |
| 404 | 409 | - **`pages/board.ts`** — the board itself is §5's **board**; the spend tables `spend.ts` draws wear §5's `.table` and `.stack`, no class of their own |
| 405 | 410 | - **`pages/map.ts`** — the map of what waits for what: `.map-ask` `.map-breath` `.map-canvas` `.map-card` `.map-counts` `.map-dot` `.map-edge` `.map-edge-crit` `.map-edge-done` `.map-empty` `.map-list` `.map-main` `.map-meta` `.map-node` `.map-rule` `.map-svg` `.map-title` `.map-tool` `.map-tools` `.map-who` `.map-who-i` `.map-who-n` `.map-word` `.map-wrap` |
| 406 | 411 | - **`studio/feed_style.ts`** — the home feed's cards and its composer (the apps rail is §5's card, row and btn; an admin's tick boxes and Archive are always shown, deliberately, with no Select toggle): `.composer` `.fcard-form` `.fcard-reason` `.fcard-reply` `.fcard-text` `.fcard-unblock` `.fcard-who` `.fcard-why` `.feed` `.feed-head` |
src/web/studio/asks_page.ts +11 −13
| @@ -79,9 +79,8 @@ const BULK_KINDS: ReadonlySet<Decision["kind"]> = new Set(["look", "review", "st | ||
| 79 | 79 | /** A row's box for the bulk form, which sits apart (`form="asks-bulk"`): forms do not nest. */ |
| 80 | 80 | const pick = (d: Decision, picked: ReadonlySet<string>): Html | null => |
| 81 | 81 | BULK_KINDS.has(d.kind) |
| 82 | ? html`<label class="ask-pick-hit"><input | |
| 82 | ? html`<label><input | |
| 83 | 83 | type="checkbox" |
| 84 | class="ask-pick" | |
| 85 | 84 | name="item" |
| 86 | 85 | value="${d.id}" |
| 87 | 86 | form="asks-bulk" |
| @@ -163,7 +162,7 @@ const clause = ( | ||
| 163 | 162 | which?: string, |
| 164 | 163 | ): Html => |
| 165 | 164 | html`<p> |
| 166 | ${weight(c, which)}${d === undefined ? null : html`<span class="ask-short">${d.short.charAt(0).toUpperCase()}${d.short.slice(1)}. </span>`}<span class="muted" | |
| 165 | ${weight(c, which)}${d === undefined ? null : html`<span data-short>${d.short.charAt(0).toUpperCase()}${d.short.slice(1)}. </span>`}<span class="muted" | |
| 167 | 166 | >If nobody acts, ${ASK_WORDS[kind].ifNothing}.</span |
| 168 | 167 | > |
| 169 | 168 | </p>`; |
| @@ -189,11 +188,11 @@ const KIND_LABEL: Readonly<Record<Decision["kind"], string>> = { | ||
| 189 | 188 | */ |
| 190 | 189 | function acts(ctx: Ctx, d: Decision): Html { |
| 191 | 190 | const { primary, others } = decisionButtons(ctx, d); |
| 192 | return html`<div class="ask-acts"> | |
| 191 | return html`<div class="bar"> | |
| 193 | 192 | ${primary} |
| 194 | 193 | ${others.length === 0 |
| 195 | 194 | ? null |
| 196 | : html`<details class="ask-more-acts"> | |
| 195 | : html`<details> | |
| 197 | 196 | <summary class="btn" data-size="sm">More</summary> |
| 198 | 197 | ${others} |
| 199 | 198 | </details>`} |
| @@ -237,11 +236,11 @@ function decisionCard(ctx: Ctx, d: Decision, picked: ReadonlySet<string>): Html | ||
| 237 | 236 | ${acts(ctx, d)}`, |
| 238 | 237 | { |
| 239 | 238 | id: askAnchor(d.id), |
| 240 | extra: "ask-card", | |
| 239 | attrs: html`data-ask`, | |
| 241 | 240 | head: html`${pick(d, picked)} |
| 242 | 241 | <h2>${title}</h2> |
| 243 | <span class="ask-meta muted small" | |
| 244 | ><b class="ask-kind">${KIND_LABEL[d.kind]}</b>${d.repo.ownerName}/${d.repo.name}</span | |
| 242 | <span class="muted small" | |
| 243 | ><b>${KIND_LABEL[d.kind]}</b>${d.repo.ownerName}/${d.repo.name}</span | |
| 245 | 244 | >${waitChip(d.waiting)}`, |
| 246 | 245 | }, |
| 247 | 246 | ); |
| @@ -249,7 +248,7 @@ function decisionCard(ctx: Ctx, d: Decision, picked: ReadonlySet<string>): Html | ||
| 249 | 248 | |
| 250 | 249 | /** What the row waits for and on whom: "ready to land · on you". */ |
| 251 | 250 | const waitChip = (w: WaitingFor): Html => |
| 252 | html`<span class="ask-waiting small" data-waiting="${w.word}" | |
| 251 | html`<span class="small" data-waiting="${w.word}" | |
| 253 | 252 | ><span class="sr-only">waiting for </span>${w.word} · on ${w.on}</span |
| 254 | 253 | >`; |
| 255 | 254 | |
| @@ -294,7 +293,7 @@ function rowCard(ctx: Ctx, r: AskRow<Decision>, picked: ReadonlySet<string>): Ht | ||
| 294 | 293 | // groups never push the composer past the fold; a wider screen holds the |
| 295 | 294 | // details open and shows every line, as before. |
| 296 | 295 | return card( |
| 297 | html`<details class="ask-group"> | |
| 296 | html`<details> | |
| 298 | 297 | <summary>Show all ${r.items.length}</summary> |
| 299 | 298 | <ul class="list"> |
| 300 | 299 | ${lines} |
| @@ -303,11 +302,10 @@ function rowCard(ctx: Ctx, r: AskRow<Decision>, picked: ReadonlySet<string>): Ht | ||
| 303 | 302 | { |
| 304 | 303 | pad: false, |
| 305 | 304 | id: askAnchor(r.id), |
| 306 | extra: "ask-card", | |
| 305 | attrs: html`data-ask`, | |
| 307 | 306 | head: html`${BULK_KINDS.has(r.kind) |
| 308 | ? html`<label class="ask-pick-hit"><input | |
| 307 | ? html`<label><input | |
| 309 | 308 | type="checkbox" |
| 310 | class="ask-pick" | |
| 311 | 309 | data-select-all |
| 312 | 310 | aria-label="Select all ${r.items.length}" |
| 313 | 311 | /></label>` |
src/web/style/content.ts +45 −41
| @@ -1039,8 +1039,10 @@ textarea.editor:focus-visible { outline: none; } | ||
| 1039 | 1039 | its words, not the column. */ |
| 1040 | 1040 | #needs-you #asks-bulk select { width: auto; max-width: 100%; } |
| 1041 | 1041 | #needs-you #asks-bulk .input[name="reason"] { flex: 1 1 12rem; width: auto; min-width: 0; } |
| 1042 | /* A row's box sits in a label, so a phone's thumb has 44 px to hit. */ | |
| 1043 | .ask-pick-hit { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; } | |
| 1042 | /* An ask is a §5 card marked \`data-ask\` (asks_page.ts); its rules reach | |
| 1043 | the card's own parts. A row's box sits in a label, in the card's head or | |
| 1044 | a row's lead, so a phone's thumb has 44 px to hit. */ | |
| 1045 | #needs-you [data-ask] :is(.card-head, .row-lead) > label { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; } | |
| 1044 | 1046 | /* A phone shows the top asks and one "N more" that opens in place to all |
| 1045 | 1047 | of them; a wider screen shows ASKS_SHOWN and its own "N more" past that. |
| 1046 | 1048 | Only where a details element can be held open: elsewhere both summaries |
| @@ -1055,57 +1057,59 @@ textarea.editor:focus-visible { outline: none; } | ||
| 1055 | 1057 | #needs-you #asks-phone-more > summary { display: none; } |
| 1056 | 1058 | #needs-you #asks-phone-more::details-content { content-visibility: visible; } |
| 1057 | 1059 | #needs-you #asks-phone-more > .stack { margin-top: 0; } |
| 1058 | #needs-you .ask-group > summary { display: none; } | |
| 1059 | #needs-you .ask-group::details-content { content-visibility: visible; } | |
| 1060 | #needs-you [data-ask] > details > summary { display: none; } | |
| 1061 | #needs-you [data-ask] > details::details-content { content-visibility: visible; } | |
| 1060 | 1062 | } |
| 1061 | 1063 | } |
| 1062 | #needs-you .ask-group > summary { padding: 10px 14px; cursor: pointer; } | |
| 1063 | /* An ask's actions: the decider, then the rest. Wide: in a line, as ever. | |
| 1064 | The kind label is for a phone, where the sentence under the title goes. */ | |
| 1065 | .ask-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; } | |
| 1066 | .ask-more-acts { display: contents; } | |
| 1067 | .ask-more-acts > summary { list-style: none; } | |
| 1068 | .ask-more-acts > summary::-webkit-details-marker { display: none; } | |
| 1069 | .ask-kind { display: none; } | |
| 1070 | .ask-waiting { display: inline-block; margin-left: 8px; padding: 0 6px; border: 1px solid var(--border); border-radius: 999px; color: var(--fg); white-space: nowrap; max-width: 100%; } | |
| 1071 | .row .ask-acts { margin-top: 0; } | |
| 1064 | #needs-you [data-ask] > details > summary { padding: 10px 14px; cursor: pointer; } | |
| 1065 | /* An ask's actions are its one \`div.bar\`: the decider, then the rest | |
| 1066 | behind a details. Wide: in a line, as ever. The kind label (the head's | |
| 1067 | bold word) is for a phone, where the sentence under the title goes. */ | |
| 1068 | #needs-you [data-ask] div.bar { gap: 6px; } | |
| 1069 | #needs-you [data-ask] .card-body > div.bar { margin-top: 12px; } | |
| 1070 | #needs-you [data-ask] div.bar > details { display: contents; } | |
| 1071 | #needs-you [data-ask] div.bar > details > summary { list-style: none; } | |
| 1072 | #needs-you [data-ask] div.bar > details > summary::-webkit-details-marker { display: none; } | |
| 1073 | #needs-you [data-ask] .card-head > .muted > b { display: none; } | |
| 1074 | #needs-you [data-waiting] { display: inline-block; margin-left: 8px; padding: 0 6px; border: 1px solid var(--border); border-radius: 999px; color: var(--fg); white-space: nowrap; max-width: 100%; } | |
| 1072 | 1075 | @supports selector(::details-content) { |
| 1073 | 1076 | @media (min-width: 481px) { |
| 1074 | .ask-more-acts > summary { display: none; } | |
| 1075 | .ask-more-acts::details-content { content-visibility: visible; display: contents; } | |
| 1077 | #needs-you [data-ask] div.bar > details > summary { display: none; } | |
| 1078 | #needs-you [data-ask] div.bar > details::details-content { content-visibility: visible; display: contents; } | |
| 1076 | 1079 | } |
| 1077 | 1080 | } |
| 1078 | 1081 | /* A phone: rows run edge to edge (the card's box, border and body padding |
| 1079 | 1082 | go; the page's 16 px gutter stays), the title wraps under "kind · repo", |
| 1080 | 1083 | the decider sits at the trailing edge and the rest wait behind "More". */ |
| 1081 | 1084 | @media (max-width: 480px) { |
| 1082 | #needs-you .ask-card { | |
| 1085 | #needs-you [data-ask] { | |
| 1083 | 1086 | margin-inline: -16px; border-inline: 0; border-radius: 0; box-shadow: none; background: none; |
| 1084 | 1087 | } |
| 1085 | .ask-card .card-head { padding: 12px 16px 0; background: none; border: 0; gap: 4px 8px; align-items: baseline; } | |
| 1086 | .ask-card .card-body { padding: 4px 16px 12px; } | |
| 1087 | .ask-card .card-foot { padding: 0 16px 12px; background: none; border: 0; } | |
| 1088 | .ask-card .card-head h2 { order: 2; flex: 1 1 100%; min-width: 0; overflow-wrap: anywhere; font-size: 1.05em; } | |
| 1089 | .ask-card .card-head h2 a { white-space: normal; overflow: visible; text-overflow: clip; } | |
| 1090 | .ask-card .ask-meta { order: 1; flex: 1; min-width: 0; overflow-wrap: anywhere; } | |
| 1091 | .ask-card .ask-kind { display: inline; margin-right: 6px; color: var(--fg); } | |
| 1092 | .ask-card .ask-kind::after { content: " ·"; font-weight: 400; } | |
| 1093 | .ask-card .ask-short { display: none; } | |
| 1094 | .ask-card .ask-waiting { order: 3; flex: 0 1 auto; margin-left: 0; min-width: 0; max-width: 100%; white-space: normal; } | |
| 1095 | .ask-card .ask-pick-hit { order: 0; } | |
| 1096 | #needs-you .ask-pick-hit { min-width: 44px; min-height: 44px; } | |
| 1097 | .ask-card .ask-pick { min-width: 24px; min-height: 24px; } | |
| 1098 | .ask-card .ask-group > summary { padding: 10px 16px; min-height: 44px; } | |
| 1099 | .ask-card .ask-group .row { flex-wrap: wrap; padding-inline: 16px; } | |
| 1100 | .ask-card .ask-group .row-main { flex-basis: 100%; } | |
| 1101 | .ask-card .ask-group .row-meta { flex: 1 1 100%; white-space: normal; } | |
| 1102 | .ask-acts { flex-direction: row-reverse; justify-content: space-between; } | |
| 1103 | .ask-acts > .btn { min-height: 44px; min-width: 96px; padding: 0 20px; flex: 0 0 auto; } | |
| 1104 | .ask-more-acts { display: flex; flex-wrap: wrap; gap: 6px; } | |
| 1105 | .ask-more-acts > summary { display: inline-flex; min-height: 44px; padding: 0 16px; } | |
| 1106 | .ask-more-acts[open] { flex: 1 1 100%; order: 2; } | |
| 1107 | .ask-more-acts[open] > summary { display: none; } | |
| 1108 | .ask-more-acts > .btn { min-height: 44px; flex: 1 1 auto; } | |
| 1088 | #needs-you [data-ask] .card-head { padding: 12px 16px 0; background: none; border: 0; gap: 4px 8px; align-items: baseline; } | |
| 1089 | #needs-you [data-ask] .card-body { padding: 4px 16px 12px; } | |
| 1090 | #needs-you [data-ask] .card-foot { padding: 0 16px 12px; background: none; border: 0; } | |
| 1091 | #needs-you [data-ask] .card-head h2 { order: 2; flex: 1 1 100%; min-width: 0; overflow-wrap: anywhere; font-size: 1.05em; } | |
| 1092 | #needs-you [data-ask] .card-head h2 a { white-space: normal; overflow: visible; text-overflow: clip; } | |
| 1093 | #needs-you [data-ask] .card-head > .muted { order: 1; flex: 1; min-width: 0; overflow-wrap: anywhere; } | |
| 1094 | #needs-you [data-ask] .card-head > .muted > b { display: inline; margin-right: 6px; color: var(--fg); } | |
| 1095 | #needs-you [data-ask] .card-head > .muted > b::after { content: " ·"; font-weight: 400; } | |
| 1096 | /* The ask's own sentence (\`data-short\`): the kind says it here. */ | |
| 1097 | #needs-you [data-ask] [data-short] { display: none; } | |
| 1098 | #needs-you [data-ask] [data-waiting] { order: 3; flex: 0 1 auto; margin-left: 0; min-width: 0; max-width: 100%; white-space: normal; } | |
| 1099 | #needs-you [data-ask] .card-head > label { order: 0; } | |
| 1100 | #needs-you [data-ask] :is(.card-head, .row-lead) > label { min-width: 44px; min-height: 44px; } | |
| 1101 | #needs-you [data-ask] label > input[type="checkbox"] { min-width: 24px; min-height: 24px; } | |
| 1102 | #needs-you [data-ask] > details > summary { padding: 10px 16px; min-height: 44px; } | |
| 1103 | #needs-you [data-ask] > details .row { flex-wrap: wrap; padding-inline: 16px; } | |
| 1104 | #needs-you [data-ask] > details .row-main { flex-basis: 100%; } | |
| 1105 | #needs-you [data-ask] > details .row-meta { flex: 1 1 100%; white-space: normal; } | |
| 1106 | #needs-you [data-ask] div.bar { flex-direction: row-reverse; justify-content: space-between; } | |
| 1107 | #needs-you [data-ask] div.bar > .btn { min-height: 44px; min-width: 96px; padding: 0 20px; flex: 0 0 auto; } | |
| 1108 | #needs-you [data-ask] div.bar > details { display: flex; flex-wrap: wrap; gap: 6px; } | |
| 1109 | #needs-you [data-ask] div.bar > details > summary { display: inline-flex; min-height: 44px; padding: 0 16px; } | |
| 1110 | #needs-you [data-ask] div.bar > details[open] { flex: 1 1 100%; order: 2; } | |
| 1111 | #needs-you [data-ask] div.bar > details[open] > summary { display: none; } | |
| 1112 | #needs-you [data-ask] div.bar > details > .btn { min-height: 44px; flex: 1 1 auto; } | |
| 1109 | 1113 | } |
| 1110 | 1114 | /* Reduced motion: the pulses hold still at a legible level, the scroll-tied |
| 1111 | 1115 | fade stays at its resting width, and these transitions land at once. */ |
test/asks-rank.test.ts +62 −10
| @@ -342,17 +342,21 @@ describe("asks that earn their place", () => { | ||
| 342 | 342 | test("a phone's ask is a full-width row: kind and repo on one line, the decider apart, the rest behind More", async () => { |
| 343 | 343 | const home = await page("/asks"); |
| 344 | 344 | const asks = home.slice(home.indexOf('<section id="needs-you"')); |
| 345 | expect(asks).toContain("ask-card"); | |
| 346 | expect(asks).toContain('<b class="ask-kind">'); | |
| 345 | expect(asks).toContain("data-ask"); | |
| 346 | expect(asks).toMatch(/<span class="muted small" ><b>[^<]+<\/b>/); | |
| 347 | 347 | // No icon column: the row opens with its kind, not a picture. |
| 348 | expect(asks.slice(0, asks.indexOf("<h2", asks.indexOf("ask-card")))).not.toContain("<svg"); | |
| 349 | expect(asks).toContain('<details class="ask-more-acts">'); | |
| 350 | expect(asks).toMatch(/class="ask-acts">\s*<button[^>]*data-variant="primary"/); | |
| 348 | expect(asks.slice(0, asks.indexOf("<h2", asks.indexOf("data-ask")))).not.toContain("<svg"); | |
| 349 | expect(asks).toMatch(/<div class="bar">\s*<button[^>]*data-variant="primary"[^]*?<details> <summary class="btn" data-size="sm">More<\/summary>/); | |
| 351 | 350 | const css = await (await fetch(`${servers.url}${home.match(/href="(\/[^"]*\.css[^"]*)"/)![1]}`)).text(); |
| 352 | expect(css).toContain(".ask-acts > .btn { min-height: 44px;"); | |
| 353 | // The markup lost the .needs-you class (#4189): no selector may still need it. | |
| 351 | expect(css).toContain("#needs-you [data-ask] div.bar > .btn { min-height: 44px;"); | |
| 352 | expect(css).toContain("#needs-you [data-ask] {\n margin-inline: -16px;"); | |
| 353 | // The markup lost the .needs-you class (#4258): no selector may still need it. | |
| 354 | 354 | expect(css).not.toMatch(/\.needs-you\b/); |
| 355 | expect(css).toContain("#needs-you .ask-card {\n margin-inline: -16px;"); | |
| 355 | // The sentence a phone hides is named, not found by its place in the line. | |
| 356 | expect(asks).toMatch(/<span data-short>[^<]+\. <\/span><span class="muted"/); | |
| 357 | const phone = css.slice(css.indexOf("@media (max-width: 480px) {\n #needs-you [data-ask] {")); | |
| 358 | expect(phone).toContain("#needs-you [data-ask] [data-short] { display: none; }"); | |
| 359 | expect(css).not.toContain("span:not(.muted)"); | |
| 356 | 360 | }); |
| 357 | 361 | |
| 358 | 362 | test("a collapsed row that ranks for security names which of its asks it is", async () => { |
| @@ -365,12 +369,60 @@ describe("asks that earn their place", () => { | ||
| 365 | 369 | // On a phone the row is its head line, its two asks one tap away; a |
| 366 | 370 | // wider screen holds them open (the lead's call: the fold wins). |
| 367 | 371 | const group = asks.slice(asks.indexOf("2 green changes wait for your look")); |
| 368 | expect(group).toContain('<details class="ask-group">'); | |
| 372 | const at = asks.indexOf("2 green changes wait for your look"); | |
| 373 | expect(asks.slice(asks.lastIndexOf("<div class=\"card\"", at), at)).toContain("data-ask"); | |
| 374 | expect(group).toContain("</div> <details> <summary>Show all 2</summary>"); | |
| 369 | 375 | expect(group).toContain("<summary>Show all 2</summary>"); |
| 370 | 376 | const css = await (await fetch(`${servers.url}${asks.match(/href="(\/[^"]*\.css[^"]*)"/)![1]}`)).text(); |
| 371 | 377 | const wide = css.slice(css.indexOf("@supports selector(::details-content) {")); |
| 372 | 378 | expect(wide.slice(wide.indexOf("@media (min-width: 481px)"))).toContain( |
| 373 | "#needs-you .ask-group > summary { display: none; }", | |
| 379 | "#needs-you [data-ask] > details > summary { display: none; }", | |
| 374 | 380 | ); |
| 375 | 381 | }); |
| 382 | ||
| 383 | test("an ask is §5's card, row and btn: no ask-* class, and ship, decline and say post what they did (#4083)", async () => { | |
| 384 | const toShip = await greenPull("shipped", "Ship this one"); | |
| 385 | const toDecline = await greenPull("declined", "Decline this one"); | |
| 386 | const asks = await page("/asks"); | |
| 387 | const section = asks.slice(asks.indexOf('<section id="needs-you"')); | |
| 388 | for (const old of ["ask-acts", "ask-card", "ask-group", "ask-kind", "ask-meta", "ask-more-acts", "ask-pick", "ask-short", "ask-waiting"]) | |
| 389 | expect(section).not.toContain(old); | |
| 390 | const id = `look:${toShip.id}`; | |
| 391 | // Ship: the card's primary button submits the ask's own hidden form. | |
| 392 | expect(section).toContain(`<button type="submit" form="ask-${id}" class="btn" data-variant="primary" data-size="sm" > Ship </button>`); | |
| 393 | expect(section).toContain( | |
| 394 | `<form id="ask-${id}" method="post" hidden action="/alice/shipped/pulls/${toShip.number}/ship"> <input type="hidden" name="pull" value="${toShip.number}" /><input type="hidden" name="back" value="/asks" /> </form>`, | |
| 395 | ); | |
| 396 | // Decline: the ask's box joins the bulk form, whose verbs include decline. | |
| 397 | expect(section).toMatch(new RegExp(`<input type="checkbox" name="item" value="${id}" form="asks-bulk"`)); | |
| 398 | expect(section).toContain('<form id="asks-bulk" method="post" action="/asks/bulk"'); | |
| 399 | expect(section).toContain('<option value="decline" >Decline</option>'); | |
| 400 | // Say: the words go on the change's own page. | |
| 401 | expect(section).toContain(`<a href="/alice/shipped/pulls/${toShip.number}#comment-body" class="btn" data-size="sm" >Not like this</a >`); | |
| 402 | // Each posts and comes back to the page. | |
| 403 | const declined = await fetch(`${servers.url}/asks/bulk`, { | |
| 404 | method: "POST", | |
| 405 | redirect: "manual", | |
| 406 | headers: { cookie, origin: servers.url }, | |
| 407 | body: new URLSearchParams({ action: "decline", item: `look:${toDecline.id}` }), | |
| 408 | }); | |
| 409 | expect(declined.status).toBe(200); | |
| 410 | expect(await declined.text()).toContain("Decline: 1 of 1"); | |
| 411 | const applied = await fetch(`${servers.url}/asks/bulk`, { | |
| 412 | method: "POST", | |
| 413 | redirect: "manual", | |
| 414 | headers: { cookie, origin: servers.url }, | |
| 415 | body: new URLSearchParams({ action: "decline", item: `look:${toDecline.id}`, apply: "1" }), | |
| 416 | }); | |
| 417 | expect(applied.status).toBe(303); | |
| 418 | expect(applied.headers.get("location")).toStartWith("/asks?op="); | |
| 419 | const shipped = await fetch(`${servers.url}/alice/shipped/pulls/${toShip.number}/ship`, { | |
| 420 | method: "POST", | |
| 421 | redirect: "manual", | |
| 422 | headers: { cookie, origin: servers.url }, | |
| 423 | body: new URLSearchParams({ pull: String(toShip.number), back: "/asks" }), | |
| 424 | }); | |
| 425 | expect(shipped.status).toBe(303); | |
| 426 | expect(shipped.headers.get("location")).toStartWith("/asks"); | |
| 427 | }); | |
| 376 | 428 | }); |
test/asks-waiting.test.ts +1 −1
| @@ -180,7 +180,7 @@ describe("asks that wait on a person", () => { | ||
| 180 | 180 | expect(page).toContain("Say what to change"); |
| 181 | 181 | expect(row).not.toContain("/settings/autonomy"); |
| 182 | 182 | expect(page).toContain(">Handed over<"); |
| 183 | expect(page).toMatch(/class="ask-pick"[^>]*value="waiting:[^"]+"[^>]*data-kind="waiting"/); | |
| 183 | expect(page).toMatch(/type="checkbox"\s+name="item"\s+value="waiting:[^"]+"[^>]*data-kind="waiting"/); | |
| 184 | 184 | }); |
| 185 | 185 | |
| 186 | 186 | test("the MCP asks tool carries the waiting kind, its why and the recommendation", async () => { |
new above
offline