web: direction card drafts and focus survive a refresh per form
Task 5 review, fix round 2.
A direction card now holds several name="note" fields: each option's,
More options' and Try again's. chat-stream.js used to save drafts by
field name, copy each one into every field with that name, and
restore focus to the first matching field. A note typed for option 2
therefore came back in every field after a refresh, and could be sent
with a different choice.
- The note forms carry a stable data-draft-key: "option <step>
<index>", "more", "again", or "build" (the older card's composer).
Drafts are already kept per card id, so the key does not repeat the
card id.
- In chat-stream.js, draftKey(el) is the form's key plus the field's
name. Saving, restoring and refocusing all use it. A form without
the attribute still keys by name, and its focus uses the old
selector, so other cards behave as before.
- internal/thintest/roster_browser_test.go is updated to round 1's
markup: the stale-revision tweak reads the Build form's revision,
and Try again is its summary rather than the old data-thread-open
button.
TDD evidence
- New browser regression: TestBrowserDirectionDrafts (build tag
browser). It serves the card at 127.0.0.1 with the real
stardust.js and chat-stream.js. It types a note in More options, then
in option 2 (where the focus stays), and one in a card without a
draft key. A card event on /api/v1/events makes chat-stream.js
re-read the page. The test then checks each field's value and the
focus, and checks that More like this on option 2 posts that
option's note.
- Red, with HEAD's chat-stream.js: option 1, option 2, option 3 and
Try again all held "fewer colours", focus did not come back to option
2's note, and the post was choice=like¬e=fewer+colours&
option_index=1, someone else's words.
- Green with the fix. TestCardMoreButtons also checks that the note
forms' draft keys are exactly the three options' keys, then "more",
then "again".
- Mutations:
draftKey returns only the name: the six failures above
restore by name: the values and the post fail
focus by name: the focus check fails
option, more or again key dropped from the template:
TestCardMoreButtons fails
- Also passing: go test ./internal/equipo/ (74s), go vet with and
without -tags browser, and these thintest browser tests:
TestBrowserRosterDecisionStates, TestBrowserRosterSubchat,
TestBrowserRosterVisual and TestBrowserTaskRows (73.6s).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 files changed,
+146
−11
internal/equipo/direction_card_browser_test.go+114 −0internal/equipo/direction_card_test.go+14 −1internal/equipo/static/chat-stream.js+12 −4internal/equipo/templates/chat.html+1 −1internal/equipo/templates/work_parts.html+2 −2internal/thintest/roster_browser_test.go+3 −3
diff --git a/internal/equipo/direction_card_browser_test.go b/internal/equipo/direction_card_browser_test.go| index 5e62c0fe..b6ea7e7b 100644 |
| --- a/internal/equipo/direction_card_browser_test.go |
| +++ b/internal/equipo/direction_card_browser_test.go |
| @@ -11,8 +11,10 @@ import ( |
| "image/png" |
| "net/http" |
| "net/http/httptest" |
| + "net/url" |
| "os" |
| "path/filepath" |
| + "sync/atomic" |
| "testing" |
| "time" |
| @@ -151,3 +153,115 @@ func TestBrowserDirectionCard(t *testing.T) { |
| } |
| } |
| } |
| + |
| +// TestBrowserDirectionDrafts: a direction card holds several note fields |
| +// (each option's, More options', Try again's). A conversation refresh |
| +// (a card event, then chat-stream.js re-reads the page) brings each |
| +// typed note back to its own field and the focus to the field it left, |
| +// and an answer posts the note typed for that option, not another's. |
| +func TestBrowserDirectionDrafts(t *testing.T) { |
| + c := feedbackTask(feedbackRounds()) |
| + var card bytes.Buffer |
| + if err := pages["chat"].ExecuteTemplate(&card, "chat-card", cardView(*c.card, nil, map[string]wire.Task{c.task.ID: c.task})); err != nil { |
| + t.Fatal(err) |
| + } |
| + var cursor atomic.Int64 |
| + cursor.Store(1) |
| + page := func() string { |
| + return fmt.Sprintf(`<!doctype html><html lang="en"><head><meta charset="utf-8"><link rel="stylesheet" href="%s"><link rel="stylesheet" href="%s"><link rel="stylesheet" href="%s">`+ |
| + `<script>window.errors = []; addEventListener("error", e => errors.push(String(e.message)));</script><script defer src="%s"></script><script defer src="%s"></script></head><body>`+ |
| + `<div equipo-conversation data-chat-stream data-cursor="%d" data-card-busy="Busy"><div equipo-scroll><ol equipo-feed>%s<li data-card="c2"><form action="/elsewhere"><textarea name="note"></textarea></form></li></ol></div><form id="composer"><div id="chat-composer"></div><textarea name="text"></textarea></form></div></body></html>`, |
| + assets.Path("static/tokens.css"), assets.Path("static/theme.css"), assets.Path("static/equipo.css"), assets.Path("static/stardust.js"), assets.Path("static/chat-stream.js"), cursor.Load(), card.String()) |
| + } |
| + trigger, posted := make(chan struct{}, 1), make(chan url.Values, 4) |
| + mux := http.NewServeMux() |
| + mux.Handle("GET /static/", assets.Handler()) |
| + mux.HandleFunc("GET /conversation", func(w http.ResponseWriter, r *http.Request) { |
| + w.Header().Set("Content-Type", "text/html; charset=utf-8") |
| + fmt.Fprint(w, page()) |
| + }) |
| + mux.HandleFunc("GET /api/v1/events", func(w http.ResponseWriter, r *http.Request) { |
| + w.Header().Set("Content-Type", "text/event-stream") |
| + w.WriteHeader(http.StatusOK) |
| + w.(http.Flusher).Flush() |
| + select { |
| + case <-trigger: |
| + fmt.Fprintf(w, "event: card\ndata: {\"cursor\":%d,\"data\":{}}\n\n", cursor.Add(1)) |
| + w.(http.Flusher).Flush() |
| + <-r.Context().Done() |
| + case <-r.Context().Done(): |
| + } |
| + }) |
| + mux.HandleFunc("POST /conversation/cards/c1/answer", func(w http.ResponseWriter, r *http.Request) { |
| + if err := r.ParseForm(); err == nil { |
| + posted <- r.PostForm |
| + } |
| + w.Header().Set("Content-Type", "application/json") |
| + fmt.Fprint(w, "{}") |
| + }) |
| + server := httptest.NewServer(mux) // 127.0.0.1 |
| + defer server.Close() |
| + |
| + opts := append(chromedp.DefaultExecAllocatorOptions[:], chromedp.ExecPath(harness.ChromePath(t)), chromedp.NoSandbox, chromedp.UserDataDir(t.TempDir())) |
| + alloc, stop := chromedp.NewExecAllocator(context.Background(), opts...) |
| + defer stop() |
| + ctx, cancel := chromedp.NewContext(alloc) |
| + defer cancel() |
| + ctx, timeout := context.WithTimeout(ctx, 60*time.Second) |
| + defer timeout() |
| + run := func(a chromedp.Action[chromedp.Void]) { |
| + t.Helper() |
| + if _, err := chromedp.Run(ctx, a); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + eval := func(js string) string { |
| + t.Helper() |
| + out, err := chromedp.Run(ctx, chromedp.Evaluate[string](js, chromedp.EvalAwaitPromise)) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + return out |
| + } |
| + run(chromedp.Navigate(server.URL + "/conversation")) |
| + if got := eval(`new Promise(r => setTimeout(() => r(document.querySelector("[data-roster-enhanced]") ? errors.join(";") : "not enhanced " + errors.join(";")), 300))`); got != "" { |
| + t.Fatalf("chat-stream.js did not start: %s", got) |
| + } |
| + // More options' note first, then option 2's, where the focus stays. |
| + field := func(key string) string { |
| + return `document.querySelector('[data-card="c1"] form[data-draft-key="` + key + `"] :is(input[name=note], textarea[name=note])')` |
| + } |
| + // A form without a draft key (any other card) keeps its draft by name. |
| + eval(`(document.querySelector('[data-card="c2"] textarea').focus(), "")`) |
| + run(chromedp.KeyEvent("plain draft")) |
| + eval(`(` + field("more") + `.focus(), "")`) |
| + run(chromedp.KeyEvent("fewer colours")) |
| + eval(`(` + field("option stnew 1") + `.focus(), "")`) |
| + run(chromedp.KeyEvent("darker header")) |
| + eval(`(document.querySelector('[data-card="c1"]').dataset.old = "1", document.querySelector('[data-card="c2"]').dataset.old = "1", "")`) |
| + trigger <- struct{}{} |
| + if got := eval(`new Promise(r => { const t0 = Date.now(); (function wait() { const c = document.querySelector('[data-card="c1"]'), d = document.querySelector('[data-card="c2"]'); if (c && !c.dataset.old && d && !d.dataset.old) return r("ok"); if (Date.now() - t0 > 5000) return r("no refresh"); setTimeout(wait, 50); })(); })`); got != "ok" { |
| + t.Fatal(got) |
| + } |
| + want := map[string]string{"option stnew 0": "", "option stnew 1": "darker header", "option stnew 2": "", "more": "fewer colours", "again": ""} |
| + for key, value := range want { |
| + if got := eval(field(key) + `.value`); got != value { |
| + t.Errorf("after the refresh %s holds %q, want %q", key, got, value) |
| + } |
| + } |
| + if got := eval(`document.querySelector('[data-card="c2"] textarea').value`); got != "plain draft" { |
| + t.Errorf("the keyless draft came back as %q", got) |
| + } |
| + if got := eval(`String(document.activeElement === ` + field("option stnew 1") + `)`); got != "true" { |
| + t.Errorf("focus did not come back to option 2's note") |
| + } |
| + eval(`(document.querySelector('[data-card="c1"] form[data-draft-key="option stnew 1"] button[value=like]').click(), "")`) |
| + select { |
| + case got := <-posted: |
| + if got.Encode() != (url.Values{"revision": {"2"}, "option_step": {"stnew"}, "option_index": {"1"}, "note": {"darker header"}, "choice": {"like"}}).Encode() { |
| + t.Errorf("posted %s", got.Encode()) |
| + } |
| + case <-ctx.Done(): |
| + t.Fatal("nothing posted") |
| + } |
| +} |
diff --git a/internal/equipo/direction_card_test.go b/internal/equipo/direction_card_test.go| index 163e20b8..8c4b5c1e 100644 |
| --- a/internal/equipo/direction_card_test.go |
| +++ b/internal/equipo/direction_card_test.go |
| @@ -85,6 +85,7 @@ func renderDirectionDecision(t *testing.T, c directionCase) string { |
| // its submit buttons carry. |
| type htmlForm struct { |
| Action string |
| + Draft string // data-draft-key |
| Hidden url.Values |
| Text map[string]bool |
| Choices []string |
| @@ -115,7 +116,8 @@ func formsOf(t *testing.T, page string) []htmlForm { |
| switch { |
| case n.Data == "form": |
| action, _ := attr(n, "action") |
| - forms = append(forms, htmlForm{Action: action, Hidden: url.Values{}, Text: map[string]bool{}}) |
| + draft, _ := attr(n, "data-draft-key") |
| + forms = append(forms, htmlForm{Action: action, Draft: draft, Hidden: url.Values{}, Text: map[string]bool{}}) |
| f = &forms[len(forms)-1] // forms do not nest |
| case f == nil: |
| case n.Data == "input" && kind == "hidden": |
| @@ -241,6 +243,17 @@ func TestCardMoreButtons(t *testing.T) { |
| if m < 0 || a < m || d < a { |
| t.Fatalf("card answers out of order (%d, %d, %d): %s", m, a, d, row) |
| } |
| + // Each note field's form has its own draft key, so a refresh brings |
| + // a typed note back to its own field (chat-stream.js draftKey). |
| + var drafts []string |
| + for _, f := range forms { |
| + if _, ok := f.Text["note"]; ok { |
| + drafts = append(drafts, f.Draft) |
| + } |
| + } |
| + if !slices.Equal(drafts, []string{"option stnew 0", "option stnew 1", "option stnew 2", "more", "again"}) { |
| + t.Fatalf("note fields' draft keys %q", drafts) |
| + } |
| plain := feedbackTask(feedbackRounds()) |
| plain.card.Options = []string{wire.ChoiceBuild, wire.ChoiceAgain, wire.ChoiceDrop} |
| forms = formsOf(t, renderDirectionCard(t, plain)) |
diff --git a/internal/equipo/static/chat-stream.js b/internal/equipo/static/chat-stream.js| index 8d2701da..97f04c2f 100644 |
| --- a/internal/equipo/static/chat-stream.js |
| +++ b/internal/equipo/static/chat-stream.js |
| @@ -836,7 +836,7 @@ |
| // A newly committed reply settles into its draft's element; a turn |
| // may already have earlier messages on the page. |
| var focused=document.activeElement, focusedCard=focused && focused.closest("[data-card]"); |
| - var cardFocus=focusedCard && /^(TEXTAREA|INPUT)$/.test(focused.tagName) ? {id:focusedCard.dataset.card,name:focused.name,start:focused.selectionStart,end:focused.selectionEnd} : null; |
| + var cardFocus=focusedCard && /^(TEXTAREA|INPUT)$/.test(focused.tagName) ? {id:focusedCard.dataset.card,name:focused.name,key:draftKey(focused),start:focused.selectionStart,end:focused.selectionEnd} : null; |
| var keep = {}, shown = {}, opened = {}; |
| feed.querySelectorAll("[equipo-thinking]:not([data-optimistic])").forEach(function (el) { keep[el.dataset.turn] = el; }); |
| // A receipt the person opened with ⋯ stays open. |
| @@ -851,7 +851,7 @@ |
| if (card.querySelector("[data-direction-thread][open]")) cardOpen.add(card.dataset.card); |
| var report = card.querySelector("[data-report-thread]"); if (report) reportOpen.set(card.dataset.card, report.open); |
| var inputs = {}; |
| - card.querySelectorAll("textarea, input:not([type=hidden])").forEach(function (el) { if (el.value) inputs[el.name] = el.value; }); |
| + card.querySelectorAll("textarea, input:not([type=hidden])").forEach(function (el) { if (el.value) inputs[draftKey(el)] = el.value; }); |
| if (Object.keys(inputs).length) cardDrafts.set(card.dataset.card, inputs); |
| }); |
| next.querySelectorAll("[data-card]").forEach(function (card) { |
| @@ -868,7 +868,7 @@ |
| card.querySelector("[equipo-roster-links]").after(status); |
| } |
| var values = cardDrafts.get(card.dataset.card); if (!values) return; |
| - card.querySelectorAll("textarea, input:not([type=hidden])").forEach(function (el) { if (values[el.name]) { el.value = values[el.name]; el.closest("form").setAttribute("data-has-content", ""); } }); |
| + card.querySelectorAll("textarea, input:not([type=hidden])").forEach(function (el) { var v = values[draftKey(el)]; if (v) { el.value = v; el.closest("form").setAttribute("data-has-content", ""); } }); |
| }); |
| feed.querySelectorAll("[data-message]").forEach(function (el) { shown[el.dataset.message] = true; }); |
| var items = Array.from(next.children).map(function (el) { |
| @@ -911,7 +911,7 @@ |
| arrange(items.concat(pending)); |
| if (window.equipoPulse) window.equipoPulse(feed); |
| if(cardFocus) { |
| - var target=feed.querySelector('[data-card="'+CSS.escape(cardFocus.id)+'"] [name="'+CSS.escape(cardFocus.name)+'"]'); |
| + var target=cardFocus.key===cardFocus.name ? feed.querySelector('[data-card="'+CSS.escape(cardFocus.id)+'"] [name="'+CSS.escape(cardFocus.name)+'"]') : Array.prototype.find.call(feed.querySelectorAll('[data-card="'+CSS.escape(cardFocus.id)+'"] textarea, [data-card="'+CSS.escape(cardFocus.id)+'"] input:not([type=hidden])'), function (el) { return draftKey(el)===cardFocus.key; }); |
| if(target) {target.focus({preventScroll:true});if(target.setSelectionRange)target.setSelectionRange(cardFocus.start,cardFocus.end);} |
| } |
| local.forEach(function (el) { place(el); }); |
| @@ -1147,6 +1147,14 @@ |
| }); |
| }); |
| // Card actions preserve the card on failure and expose the result in place. |
| + // draftKey names a card field across a refresh: its name, and in a form |
| + // with data-draft-key (one card can hold several note fields: each |
| + // option's, More options', Try again's) that form's key too, so a draft |
| + // and the focus come back to the field they left. |
| + function draftKey(el) { |
| + var f = el.closest("form"), k = f && f.dataset.draftKey; |
| + return k ? k + " " + el.name : el.name; |
| + } |
| var cardBusy = new Map(), cardDrafts = new Map(), cardOpen = new Set(), reportOpen = new Map(), cardSuccess = new Map(), toastTimer; |
| function cardSubmit(f, button) { |
| var card = f.closest("[data-card]"), id = card && card.dataset.card; |
diff --git a/internal/equipo/templates/chat.html b/internal/equipo/templates/chat.html| index cb9e2660..68a2d5c8 100644 |
| --- a/internal/equipo/templates/chat.html |
| +++ b/internal/equipo/templates/chat.html |
| @@ -12,7 +12,7 @@ |
| <div equipo-thread-list role="log" aria-live="polite"><div equipo-thread-turn data-first><span equipo-thread-avatar>{{if eq .AuthorIcon "sparkles"}}{{template "roster-mark" .}}{{else}}{{icon .AuthorIcon}}{{end}}</span><div equipo-thread-bubble><div equipo-thread-who>{{.Author}}</div><div equipo-thread-text>{{.Line}}</div></div></div>{{template "roster-thread-turns" .}}</div> |
| {{if .Open}}{{if .Options}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}<button rst-btn name="choice" value="{{.}}" type="submit">{{.}}</button>{{end}}</form>{{else}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-mini-composer><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}<div equipo-mini-pill><textarea name="choice" required maxlength="2000" rows="1" aria-label="{{copy "chat.card.answer"}}" placeholder="{{copy "chat.card.answer"}}"></textarea><button type="submit" data-thread-send aria-label="{{copy "conversation.send_short"}}" data-busy-label="{{copy "roster.sending"}}">{{icon "arrow-up"}}</button></div></form>{{end}}{{else if not .Presentation.Waiting}}<form method="post" action="/conversation/cards/{{.ID}}/reply" data-card-form equipo-mini-composer><input type="hidden" name="request_id" value="{{.ReplyKey}}">{{template "card-job" .}}<div equipo-mini-pill><textarea name="body" required maxlength="2000" rows="1" aria-label="{{copy "roster.reply"}}" placeholder="{{copy "roster.reply"}}"></textarea><button type="submit" data-thread-send aria-label="{{copy "conversation.send_short"}}" data-busy-label="{{copy "roster.sending"}}">{{icon "arrow-up"}}</button></div></form>{{end}}</div> |
| {{else if eq .Kind "home"}}<p equipo-card-line>{{icon "folder"}}<span>{{.Line}}</span></p><form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}<button rst-btn="primary" name="choice" value="confirm" type="submit">{{copy "chat.card.confirm"}}</button></form> |
| -{{else if eq .Kind "direction"}}<p equipo-card-line>{{.Line}}</p>{{template "design-gallery" .Gallery}}{{if .Open}}<div equipo-direction-actions>{{range .DirectionAnswers}}{{if eq . "build"}}{{if $.BuildNote}}<details equipo-subchat data-direction-build><summary rst-btn="primary">{{copy "chat.card.build"}}</summary><form method="post" action="/conversation/cards/{{$.ID}}/answer" data-card-form equipo-mini-composer><input type="hidden" name="revision" value="{{$.Revision}}">{{template "card-job" $}}<input type="hidden" name="choice" value="build"><div equipo-mini-pill><textarea name="note" required maxlength="1000" rows="1" aria-label="{{copy "chat.card.build_note"}}" placeholder="{{copy "chat.card.build_note"}}"></textarea><button type="submit" data-thread-send data-direction-choice="build" aria-label="{{copy "chat.card.build"}}" data-busy-label="{{copy "roster.building"}}">{{icon "arrow-up"}}</button></div></form></details>{{else}}<form method="post" action="/conversation/cards/{{$.ID}}/answer" data-card-form><input type="hidden" name="revision" value="{{$.Revision}}">{{template "card-job" $}}{{template "project-name-confirm" $}}<button rst-btn="primary" name="choice" value="build" type="submit" data-direction-choice="build" data-busy-label="{{copy "roster.building"}}">{{copy "chat.card.build"}}</button></form>{{end}}{{else if eq . "more"}}<form method="post" action="/conversation/cards/{{$.ID}}/answer" data-card-form equipo-note-form data-direction-more><input type="hidden" name="revision" value="{{$.Revision}}">{{template "card-job" $}}<input rst-input name="note" maxlength="1000" aria-label="{{copy "chat.card.option_note"}}" placeholder="{{copy "chat.card.option_note"}}"><button rst-btn name="choice" value="more" type="submit" data-direction-choice="more" data-busy-label="{{copy "roster.sending"}}">{{copy "chat.card.more_options"}}</button></form>{{else if eq . "again"}}<details equipo-subchat data-direction-thread><summary rst-btn>{{copy "chat.card.again"}}</summary><div equipo-thread-list role="log" aria-live="polite"><div equipo-thread-turn><span equipo-thread-avatar>{{icon $.AuthorIcon}}</span><div equipo-thread-bubble><div equipo-thread-who>{{$.Author}}</div><div equipo-thread-text>{{copy "roster.change"}}</div></div></div></div><form method="post" action="/conversation/cards/{{$.ID}}/answer" data-card-form equipo-mini-composer><input type="hidden" name="revision" value="{{$.Revision}}">{{template "card-job" $}}<input type="hidden" name="choice" value="again"><div equipo-mini-pill><textarea name="note" required maxlength="1000" rows="1" aria-label="{{copy "roster.reply"}}" placeholder="{{copy "roster.reply"}}"></textarea><button type="submit" data-thread-send data-direction-choice="again" aria-label="{{copy "conversation.send_short"}}" data-busy-label="{{copy "roster.sending"}}">{{icon "arrow-up"}}</button></div></form></details>{{else}}<form method="post" action="/conversation/cards/{{$.ID}}/answer" data-card-form><input type="hidden" name="revision" value="{{$.Revision}}">{{template "card-job" $}}<button rst-btn name="choice" value="{{.}}" type="submit" data-direction-choice="{{.}}">{{copy (printf "chat.card.%s" .)}}</button></form>{{end}}{{end}}</div>{{else}}{{with .Note}}<p equipo-card-done role="status">{{.}}</p>{{end}}{{if .Presentation.Thread}}<div equipo-subchat data-roster-step="{{.Presentation.StepID}}"><div equipo-thread-list role="log" aria-live="polite">{{template "roster-thread-turns" .}}</div></div>{{end}}{{end}} |
| +{{else if eq .Kind "direction"}}<p equipo-card-line>{{.Line}}</p>{{template "design-gallery" .Gallery}}{{if .Open}}<div equipo-direction-actions>{{range .DirectionAnswers}}{{if eq . "build"}}{{if $.BuildNote}}<details equipo-subchat data-direction-build><summary rst-btn="primary">{{copy "chat.card.build"}}</summary><form method="post" action="/conversation/cards/{{$.ID}}/answer" data-card-form equipo-mini-composer data-draft-key="build"><input type="hidden" name="revision" value="{{$.Revision}}">{{template "card-job" $}}<input type="hidden" name="choice" value="build"><div equipo-mini-pill><textarea name="note" required maxlength="1000" rows="1" aria-label="{{copy "chat.card.build_note"}}" placeholder="{{copy "chat.card.build_note"}}"></textarea><button type="submit" data-thread-send data-direction-choice="build" aria-label="{{copy "chat.card.build"}}" data-busy-label="{{copy "roster.building"}}">{{icon "arrow-up"}}</button></div></form></details>{{else}}<form method="post" action="/conversation/cards/{{$.ID}}/answer" data-card-form><input type="hidden" name="revision" value="{{$.Revision}}">{{template "card-job" $}}{{template "project-name-confirm" $}}<button rst-btn="primary" name="choice" value="build" type="submit" data-direction-choice="build" data-busy-label="{{copy "roster.building"}}">{{copy "chat.card.build"}}</button></form>{{end}}{{else if eq . "more"}}<form method="post" action="/conversation/cards/{{$.ID}}/answer" data-card-form equipo-note-form data-direction-more data-draft-key="more"><input type="hidden" name="revision" value="{{$.Revision}}">{{template "card-job" $}}<input rst-input name="note" maxlength="1000" aria-label="{{copy "chat.card.option_note"}}" placeholder="{{copy "chat.card.option_note"}}"><button rst-btn name="choice" value="more" type="submit" data-direction-choice="more" data-busy-label="{{copy "roster.sending"}}">{{copy "chat.card.more_options"}}</button></form>{{else if eq . "again"}}<details equipo-subchat data-direction-thread><summary rst-btn>{{copy "chat.card.again"}}</summary><div equipo-thread-list role="log" aria-live="polite"><div equipo-thread-turn><span equipo-thread-avatar>{{icon $.AuthorIcon}}</span><div equipo-thread-bubble><div equipo-thread-who>{{$.Author}}</div><div equipo-thread-text>{{copy "roster.change"}}</div></div></div></div><form method="post" action="/conversation/cards/{{$.ID}}/answer" data-card-form equipo-mini-composer data-draft-key="again"><input type="hidden" name="revision" value="{{$.Revision}}">{{template "card-job" $}}<input type="hidden" name="choice" value="again"><div equipo-mini-pill><textarea name="note" required maxlength="1000" rows="1" aria-label="{{copy "roster.reply"}}" placeholder="{{copy "roster.reply"}}"></textarea><button type="submit" data-thread-send data-direction-choice="again" aria-label="{{copy "conversation.send_short"}}" data-busy-label="{{copy "roster.sending"}}">{{icon "arrow-up"}}</button></div></form></details>{{else}}<form method="post" action="/conversation/cards/{{$.ID}}/answer" data-card-form><input type="hidden" name="revision" value="{{$.Revision}}">{{template "card-job" $}}<button rst-btn name="choice" value="{{.}}" type="submit" data-direction-choice="{{.}}">{{copy (printf "chat.card.%s" .)}}</button></form>{{end}}{{end}}</div>{{else}}{{with .Note}}<p equipo-card-done role="status">{{.}}</p>{{end}}{{if .Presentation.Thread}}<div equipo-subchat data-roster-step="{{.Presentation.StepID}}"><div equipo-thread-list role="log" aria-live="polite">{{template "roster-thread-turns" .}}</div></div>{{end}}{{end}} |
| {{else if eq .Kind "specialist"}}<p equipo-card-line>{{.Line}}</p>{{with .Specialist}}{{range .Capabilities}}<p equipo-card-note data-capability="{{.ID}}">{{.Words}}</p>{{end}}<p equipo-card-note data-specialist-brief>{{printf (copy "chat.card.specialist_brief") .Brief}}</p>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}<button rst-btn="{{if eq . "add"}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-specialist-choice="{{.}}">{{copy (printf "chat.card.%s" .)}}</button>{{end}}</form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}} |
| {{else if eq .Kind "research_sources"}}<p equipo-card-line>{{.Line}}</p>{{with .Name}}<p equipo-card-note data-research-task>{{printf (copy "chat.card.research_for") .}}</p>{{end}}{{with .Research}}<p equipo-card-note data-research-question>{{printf (copy "chat.card.research_looks_for") .Question}}</p><ul equipo-card-list data-research-urls>{{range .URLs}}<li><code>{{.}}</code></li>{{end}}</ul>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}<button rst-btn="{{if eq . "allow"}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-research-choice="{{.}}">{{copy (printf "chat.card.%s" .)}}</button>{{end}}</form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}} |
| {{else if eq .Kind "instance_inventory"}}<p equipo-card-line>{{.Line}}</p>{{with .Inventory}}<ul equipo-card-list data-instance-addresses>{{range .Addresses}}<li><code>{{.}}</code></li>{{end}}</ul>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}"><button rst-btn="primary" name="choice" value="confirm" type="submit" data-instance-confirm>{{copy "services.inventory.confirm"}}</button></form>{{end}}{{else if eq .Kind "research_inventory"}}<p equipo-card-line>{{.Line}}</p>{{with .Inventory}}<ul equipo-card-list data-research-addresses>{{range .Addresses}}<li><code>{{.}}</code></li>{{end}}</ul>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}<button rst-btn="primary" name="choice" value="confirm" type="submit" data-inventory-confirm>{{copy "chat.card.inventory_confirm"}}</button></form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}} |
diff --git a/internal/equipo/templates/work_parts.html b/internal/equipo/templates/work_parts.html| index 79def70e..41586cbe 100644 |
| --- a/internal/equipo/templates/work_parts.html |
| +++ b/internal/equipo/templates/work_parts.html |
| @@ -37,7 +37,7 @@ |
| {{if $.Head}}{{template "mono" $t.Mono}}<div equipo-d-title><a href="/tasks/{{$t.ID}}">{{$t.Title}}</a><div equipo-quiet>{{template "placement-chip" $t}} · {{template "source" $t}}</div></div>{{end}} |
| <p equipo-d-why>{{.Why}}</p> |
| {{with .Ask}}<p equipo-d-ask{{if $t.Decision.SandboxHeld}} data-sandbox-held{{end}}>{{.}}</p>{{end}}{{if .Link}}<p equipo-quiet data-direction-line>{{with .LinkText}}{{.}} {{end}}<a equipo-link href="{{.Link}}" rel="noopener noreferrer" target="_blank" data-direction-link>{{.LinkLabel}}</a>{{with .AltLink}} <a equipo-link href="{{.}}" rel="noopener noreferrer" target="_blank" data-direction-branch>{{$t.Decision.AltLabel}}</a>{{end}}</p>{{end}}{{template "design-gallery" .Gallery}}{{with .Said}}<p equipo-quiet data-triage-said>{{.}}</p>{{end}}{{with .Failed}}<p equipo-quiet data-triage-failed>{{.}}</p>{{end}}{{with .Recommend}}<p equipo-quiet data-triage-recommend>{{.}}</p>{{end}} |
| -<div equipo-d-actions>{{if .CopyContinue}}<form method="post" action="/conversation/tasks/{{$t.ID}}/continue-without-copy"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-copy-continue>{{copy "copy.continue"}}</button></form>{{end}}{{if .More}}{{with .Card}}<form method="post" action="/conversation/cards/{{.ID}}/answer" equipo-note-form data-direction-more><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="task" value="{{$t.ID}}"><input rst-input name="note" maxlength="1000" aria-label="{{copy "chat.card.option_note"}}" placeholder="{{copy "chat.card.option_note"}}"><button equipo-btn type="submit" name="choice" value="more" data-merge-choice="more">{{copy "chat.card.more_options"}}</button></form>{{end}}{{end}}{{with .Card}}<form method="post" action="/conversation/cards/{{.ID}}/answer"><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="task" value="{{$t.ID}}">{{if $.Task.Decision.Note}}{{if $.Task.Decision.BuildNote}}<textarea rst-input name="note" required maxlength="1000" rows="2" aria-label="{{copy "chat.card.direction_note_options"}}" placeholder="{{copy "chat.card.direction_note_options"}}" data-direction-note></textarea>{{else}}<textarea rst-input name="note" maxlength="1000" rows="2" aria-label="{{copy "chat.card.direction_note"}}" placeholder="{{copy "chat.card.direction_note"}}" data-direction-note></textarea>{{end}}{{end}}{{range $.Task.Decision.Choices}}<button equipo-btn{{if .Primary}} data-primary{{end}} type="submit" name="choice" value="{{.Value}}" data-merge-choice="{{.Value}}"{{if and $.Task.Decision.BuildNote (eq .Value "drop")}} formnovalidate{{end}}>{{.Label}}</button>{{end}}</form>{{end}}{{if .Fold}}<form method="post" action="/tasks/{{$t.ID}}/duplicate"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="of" value="{{$t.Dup.ID}}"><button equipo-btn data-primary type="submit" data-task-duplicate>{{copy "work.decide.fold"}}</button></form>{{end}}{{if .Recover}}<form method="post" action="/conversation/tasks/{{$t.ID}}/recover"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-task-recover>{{copy "work.recover"}}</button></form>{{end}}{{with .Unsandboxed}}<details equipo-mach-confirm data-unsandboxed><summary equipo-btn>{{copy "work.decide.unsandboxed"}}</summary><div><p>{{.Warning}}</p><form method="post" action="/conversation/tasks/{{$t.ID}}/unsandboxed"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="step" value="{{.Step}}"><input type="hidden" name="attempt" value="{{.Attempt}}"><button equipo-btn data-danger type="submit" data-task-unsandboxed>{{copy "work.decide.unsandboxed_confirm"}}</button></form></div></details>{{end}}{{if .Retry}}<form method="post" action="/conversation/tasks/{{$t.ID}}/retry"><input type="hidden" name="from" value="{{$.From}}"><button {{if .Fold}}equipo-link{{else}}equipo-btn data-primary{{end}} type="submit" data-task-retry>{{copy "work.retry"}}</button></form>{{end}}{{if .Round}}<form method="post" action="/conversation/tasks/{{$t.ID}}/round"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-task-round>{{copy "work.decide.round"}}</button></form>{{end}}{{if .Talk}}<a equipo-btn href="/conversation?about={{$t.ID}}" data-ask-coordinator>{{copy "work.decide.ask_coordinator"}}</a>{{end}}{{if .Cancel}}<form method="post" action="/conversation/tasks/{{$t.ID}}/cancel"><input type="hidden" name="from" value="{{$.From}}"><button equipo-link type="submit" data-task-cancel>{{copy "work.decide.cancel"}}</button></form>{{end}}{{with .Hint}}<span equipo-quiet>{{.}}</span>{{end}}<span equipo-d-quiet>{{if .AddClaude}}<a equipo-link href="{{.AddClaude}}" data-add-claude>{{.AddClaudeLabel}}</a>{{end}}{{if .Mac}}<a equipo-link href="/conversation/settings/machines/add" data-set-up-mac>{{copy "work.decide.mac_set_up"}}</a>{{end}}<a equipo-link href="/conversation?about={{$t.ID}}" data-ask-about>{{copy "work.ask_about"}}</a></span></div> |
| +<div equipo-d-actions>{{if .CopyContinue}}<form method="post" action="/conversation/tasks/{{$t.ID}}/continue-without-copy"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-copy-continue>{{copy "copy.continue"}}</button></form>{{end}}{{if .More}}{{with .Card}}<form method="post" action="/conversation/cards/{{.ID}}/answer" equipo-note-form data-direction-more data-draft-key="more"><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="task" value="{{$t.ID}}"><input rst-input name="note" maxlength="1000" aria-label="{{copy "chat.card.option_note"}}" placeholder="{{copy "chat.card.option_note"}}"><button equipo-btn type="submit" name="choice" value="more" data-merge-choice="more">{{copy "chat.card.more_options"}}</button></form>{{end}}{{end}}{{with .Card}}<form method="post" action="/conversation/cards/{{.ID}}/answer"><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="task" value="{{$t.ID}}">{{if $.Task.Decision.Note}}{{if $.Task.Decision.BuildNote}}<textarea rst-input name="note" required maxlength="1000" rows="2" aria-label="{{copy "chat.card.direction_note_options"}}" placeholder="{{copy "chat.card.direction_note_options"}}" data-direction-note></textarea>{{else}}<textarea rst-input name="note" maxlength="1000" rows="2" aria-label="{{copy "chat.card.direction_note"}}" placeholder="{{copy "chat.card.direction_note"}}" data-direction-note></textarea>{{end}}{{end}}{{range $.Task.Decision.Choices}}<button equipo-btn{{if .Primary}} data-primary{{end}} type="submit" name="choice" value="{{.Value}}" data-merge-choice="{{.Value}}"{{if and $.Task.Decision.BuildNote (eq .Value "drop")}} formnovalidate{{end}}>{{.Label}}</button>{{end}}</form>{{end}}{{if .Fold}}<form method="post" action="/tasks/{{$t.ID}}/duplicate"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="of" value="{{$t.Dup.ID}}"><button equipo-btn data-primary type="submit" data-task-duplicate>{{copy "work.decide.fold"}}</button></form>{{end}}{{if .Recover}}<form method="post" action="/conversation/tasks/{{$t.ID}}/recover"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-task-recover>{{copy "work.recover"}}</button></form>{{end}}{{with .Unsandboxed}}<details equipo-mach-confirm data-unsandboxed><summary equipo-btn>{{copy "work.decide.unsandboxed"}}</summary><div><p>{{.Warning}}</p><form method="post" action="/conversation/tasks/{{$t.ID}}/unsandboxed"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="step" value="{{.Step}}"><input type="hidden" name="attempt" value="{{.Attempt}}"><button equipo-btn data-danger type="submit" data-task-unsandboxed>{{copy "work.decide.unsandboxed_confirm"}}</button></form></div></details>{{end}}{{if .Retry}}<form method="post" action="/conversation/tasks/{{$t.ID}}/retry"><input type="hidden" name="from" value="{{$.From}}"><button {{if .Fold}}equipo-link{{else}}equipo-btn data-primary{{end}} type="submit" data-task-retry>{{copy "work.retry"}}</button></form>{{end}}{{if .Round}}<form method="post" action="/conversation/tasks/{{$t.ID}}/round"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-task-round>{{copy "work.decide.round"}}</button></form>{{end}}{{if .Talk}}<a equipo-btn href="/conversation?about={{$t.ID}}" data-ask-coordinator>{{copy "work.decide.ask_coordinator"}}</a>{{end}}{{if .Cancel}}<form method="post" action="/conversation/tasks/{{$t.ID}}/cancel"><input type="hidden" name="from" value="{{$.From}}"><button equipo-link type="submit" data-task-cancel>{{copy "work.decide.cancel"}}</button></form>{{end}}{{with .Hint}}<span equipo-quiet>{{.}}</span>{{end}}<span equipo-d-quiet>{{if .AddClaude}}<a equipo-link href="{{.AddClaude}}" data-add-claude>{{.AddClaudeLabel}}</a>{{end}}{{if .Mac}}<a equipo-link href="/conversation/settings/machines/add" data-set-up-mac>{{copy "work.decide.mac_set_up"}}</a>{{end}}<a equipo-link href="/conversation?about={{$t.ID}}" data-ask-about>{{copy "work.ask_about"}}</a></span></div> |
| </div>{{end}}{{end}} |
| {{define "star-toggle"}}{{$p := .P}}<form method="post" action="/projects/{{$p.ID}}/star" equipo-star-form><input type="hidden" name="starred" value="{{if $p.Star.On}}0{{else}}1{{end}}"><input type="hidden" name="from" value="{{.From}}"><button type="submit" equipo-star{{if $p.Star.On}} aria-pressed="true"{{if $p.Star.Auto}} data-auto{{end}}{{else}} aria-pressed="false"{{end}} aria-label="{{$p.Star.Label}}" title="{{$p.Star.Who}}" data-star-toggle>{{icon "star"}}</button></form>{{end}} |
| {{define "project-facts"}}{{with .StackLine}}<span>{{if $.PhoneStack}}{{icon "phone"}}{{else}}{{icon "code"}}{{end}}{{.}}</span>{{end}}{{with .Repos}}<span data-repos>{{icon "git"}}{{if eq (len .) 1}}{{copy "work.project.one_repo"}}{{else}}{{printf (copy "work.project.repos") (len .)}}{{end}}</span>{{end}}{{with .ChecksLine}}<span data-tone="{{if $.Checks.Here}}positive{{else}}warning{{end}}" data-checks-fact>{{if $.Checks.Here}}{{icon "check-circle"}}{{else}}{{icon "help-circle"}}{{end}}{{.}}</span>{{end}}{{end}} |
| @@ -57,4 +57,4 @@ |
| instance's task-file route only (the task page and the direction |
| card). On an open direction card each option is a form of its own: |
| Build this one and More like this name it by step and index. */}} |
| -{{define "design-gallery"}}{{with .}}{{$a := .Answer}}<div equipo-captures data-captures>{{range .Rounds}}<div equipo-capture-round data-round="{{.Step}}">{{range .Options}}<section equipo-capture-option data-option><h3>{{.Label}}</h3>{{with .Direction}}<p equipo-direction>{{.}}</p>{{end}}{{if .Captures}}<ul equipo-kept>{{range .Captures}}<li><a href="{{.Src}}" target="_blank" rel="noopener" data-capture="{{.ID}}"><figure><img src="{{.Src}}" alt="{{.Alt}}" width="{{.Width}}" height="{{.Height}}" loading="lazy" decoding="async"><figcaption>{{.Caption}}</figcaption></figure></a></li>{{end}}</ul>{{else}}<p equipo-quiet>{{copy "work.captures.none"}}</p>{{end}}{{if and $a .Step}}<form method="post" action="/conversation/cards/{{$a.CardID}}/answer"{{if not $a.Task}} data-card-form{{end}} equipo-option-actions><input type="hidden" name="revision" value="{{$a.Revision}}">{{with $a.From}}<input type="hidden" name="from" value="{{.}}">{{end}}{{with $a.Task}}<input type="hidden" name="task" value="{{.}}">{{end}}{{with $a.Job}}<input type="hidden" name="from" value="job"><input type="hidden" name="job" value="{{.}}">{{end}}<input type="hidden" name="option_step" value="{{.Step}}"><input type="hidden" name="option_index" value="{{.Index}}"><input rst-input name="note" maxlength="1000" aria-label="{{copy "chat.card.option_note"}}" placeholder="{{copy "chat.card.option_note"}}">{{if $a.Task}}<button equipo-btn data-primary type="submit" name="choice" value="build" data-option-choice="build">{{copy "chat.card.build"}}</button>{{if $a.Like}}<button equipo-btn type="submit" name="choice" value="like" data-option-choice="like">{{copy "chat.card.like"}}</button>{{end}}{{else}}<button rst-btn="primary" type="submit" name="choice" value="build" data-option-choice="build" data-busy-label="{{copy "roster.building"}}">{{copy "chat.card.build"}}</button>{{if $a.Like}}<button rst-btn type="submit" name="choice" value="like" data-option-choice="like" data-busy-label="{{copy "roster.sending"}}">{{copy "chat.card.like"}}</button>{{end}}{{end}}</form>{{end}}</section>{{end}}</div>{{end}}{{with .Earlier}}<p equipo-quiet data-earlier><a equipo-link href="{{.}}">{{copy "work.captures.earlier"}}</a></p>{{end}}</div>{{end}}{{end}} |
| +{{define "design-gallery"}}{{with .}}{{$a := .Answer}}<div equipo-captures data-captures>{{range .Rounds}}<div equipo-capture-round data-round="{{.Step}}">{{range .Options}}<section equipo-capture-option data-option><h3>{{.Label}}</h3>{{with .Direction}}<p equipo-direction>{{.}}</p>{{end}}{{if .Captures}}<ul equipo-kept>{{range .Captures}}<li><a href="{{.Src}}" target="_blank" rel="noopener" data-capture="{{.ID}}"><figure><img src="{{.Src}}" alt="{{.Alt}}" width="{{.Width}}" height="{{.Height}}" loading="lazy" decoding="async"><figcaption>{{.Caption}}</figcaption></figure></a></li>{{end}}</ul>{{else}}<p equipo-quiet>{{copy "work.captures.none"}}</p>{{end}}{{if and $a .Step}}<form method="post" action="/conversation/cards/{{$a.CardID}}/answer"{{if not $a.Task}} data-card-form{{end}} equipo-option-actions data-draft-key="option {{.Step}} {{.Index}}"><input type="hidden" name="revision" value="{{$a.Revision}}">{{with $a.From}}<input type="hidden" name="from" value="{{.}}">{{end}}{{with $a.Task}}<input type="hidden" name="task" value="{{.}}">{{end}}{{with $a.Job}}<input type="hidden" name="from" value="job"><input type="hidden" name="job" value="{{.}}">{{end}}<input type="hidden" name="option_step" value="{{.Step}}"><input type="hidden" name="option_index" value="{{.Index}}"><input rst-input name="note" maxlength="1000" aria-label="{{copy "chat.card.option_note"}}" placeholder="{{copy "chat.card.option_note"}}">{{if $a.Task}}<button equipo-btn data-primary type="submit" name="choice" value="build" data-option-choice="build">{{copy "chat.card.build"}}</button>{{if $a.Like}}<button equipo-btn type="submit" name="choice" value="like" data-option-choice="like">{{copy "chat.card.like"}}</button>{{end}}{{else}}<button rst-btn="primary" type="submit" name="choice" value="build" data-option-choice="build" data-busy-label="{{copy "roster.building"}}">{{copy "chat.card.build"}}</button>{{if $a.Like}}<button rst-btn type="submit" name="choice" value="like" data-option-choice="like" data-busy-label="{{copy "roster.sending"}}">{{copy "chat.card.like"}}</button>{{end}}{{end}}</form>{{end}}</section>{{end}}</div>{{end}}{{with .Earlier}}<p equipo-quiet data-earlier><a equipo-link href="{{.}}">{{copy "work.captures.earlier"}}</a></p>{{end}}</div>{{end}}{{end}} |
diff --git a/internal/thintest/roster_browser_test.go b/internal/thintest/roster_browser_test.go| index 6dd55124..84aad446 100644 |
| --- a/internal/thintest/roster_browser_test.go |
| +++ b/internal/thintest/roster_browser_test.go |
| @@ -182,7 +182,7 @@ func TestBrowserRosterDecisionStates(t *testing.T) { |
| p.open("/conversation") |
| card := `[data-card="` + c.ID + `"]` |
| p.wait(`document.querySelector('`+card+` [data-direction-choice="build"]')`, "direction") |
| - p.check(`(()=>{document.querySelector('`+card+` [equipo-actions] [name=revision]').value='0';return true})()`, "make stale") |
| + p.check(`(()=>{document.querySelector('`+card+` form:has([data-direction-choice="build"]) [name=revision]').value='0';return true})()`, "make stale") |
| p.click(card + ` [data-direction-choice="build"]`) |
| p.wait(`document.querySelector('`+card+` [equipo-card-error]').textContent.includes('This item has changed')`, "stale revision error") |
| if k := r.task(id); k.Stage != wire.StageInReview { |
| @@ -190,7 +190,7 @@ func TestBrowserRosterDecisionStates(t *testing.T) { |
| } |
| p.shot(fmt.Sprintf("roster-decision-stale-%d-%s", width, scheme)) |
| p.click(card + ` [equipo-card-error] button`) |
| - p.wait(`document.querySelector('`+card+` [equipo-actions] [name=revision]').value==='1'`, "refresh stale decision") |
| + p.wait(`document.querySelector('`+card+` form:has([data-direction-choice="build"]) [name=revision]').value==='1'`, "refresh stale decision") |
| p.check(`(()=>{const b=document.querySelector('`+card+` [data-direction-choice="build"]');b.scrollIntoView({block:'center'});b.addEventListener('click',e=>e.preventDefault(),{once:true});return true})()`, "inspect pointer states") |
| xy := eval[[]float64](p, `(()=>{const r=document.querySelector('`+card+` [data-direction-choice="build"]').getBoundingClientRect();return [r.x+r.width/2,r.y+r.height/2]})()`) |
| p.do(chromedp.MouseEvent(input.DispatchMouseEventTypeMouseMoved, xy[0], xy[1])) |
| @@ -212,7 +212,7 @@ func TestBrowserRosterDecisionStates(t *testing.T) { |
| p.wait(`!document.querySelector('`+card+` [equipo-card-error]').hidden`, "in-place error") |
| p.shot(fmt.Sprintf("roster-decision-error-%d-%s", width, scheme)) |
| p.check(`(()=>{window.fetch=window.__fetch;return true})()`, "restore request") |
| - p.click(card + ` [data-thread-open]`) |
| + p.click(card + ` [data-direction-thread] > summary`) |
| p.check(`document.activeElement===document.querySelector('`+card+` textarea')`, "Try again focuses sub-chat") |
| p.check(`(()=>{const i=document.querySelector('`+card+` textarea');i.value='Keep the runner step, drop the tour.';i.dispatchEvent(new Event('input',{bubbles:true}));return true})()`, "note") |
| p.click(card + ` [data-thread-send]`) |