Draw chat edges without mask-composite; go on after connecting Oficina
Safari filled the focused composer with the edge's conic gradient: the unprefixed mask shorthand, after -webkit-mask-composite: xor, left the layers adding instead of excluding. The composer's focus edge and the thinking bubble's edge now use a ring mask of side strips and corner quarter rings that only add, the default everywhere. Back from connecting Oficina, Base sends one line for the person (PENDING copy) under a key from the consent, so the Assistant answers what they asked and shows its thinking bubble; a reload or a second return sends nothing more, and denied, expired or failed sends nothing. The one-shot note now sits in the conversation after the reply it follows. Password managers are told to leave the composer alone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 files changed,
+529
−28
docs/copy-pending.md+6 −0internal/browsertest/edge_ring_test.go+133 −0internal/browsertest/oficina_resume_test.go+117 −0internal/browsertest/thinking_test.go+1 −1internal/equipo/equipotest/chat.go+16 −0internal/look/static/app.css+30 −9internal/look/static/ask.js+17 −0internal/web/ask.go+11 −1internal/web/ask_oficina.go+39 −5internal/web/templates/partials/chat.html+4 −4internal/webtest/oficina_connect_test.go+155 −8
diff --git a/docs/copy-pending.md b/docs/copy-pending.md| index 4dada16..4dac971 100644 |
| --- a/docs/copy-pending.md |
| +++ b/docs/copy-pending.md |
| @@ -417,3 +417,9 @@ Review 12 (approved, Paul, 2026-11-17, copy review hwmz4ttgslm5ed3k4lafixgffa): |
| | partials/chat.html, ask.js | APPROVED (Paul, 2026-11-17): the button at the end of the Assistant's reply, beside the Oficina mark | Connect Oficina | |
| | partials/chat.html, ask.js | APPROVED (Paul, 2026-11-17): the line under the button, naming what connecting unlocks | Calendar, Docs, Sheets and more | |
| | ask.js | APPROVED (Paul, 2026-11-17): what the button becomes once Oficina is connected, after a tick icon (proposed as "Connected ✓"; the tick is drawn, not typed) | Connected | |
| + |
| +Review 13 (PENDING, drafted 2026-11-19): going on after connecting Oficina. Back from connecting Oficina in the chat, Base sends one line for the person, which shows as their message in the conversation, and the Assistant answers what they asked with Oficina now connected. The approved "Oficina connected." now shows only when that line could not be sent. The other approved lines (turned down, expired, unreachable) now sit in the conversation after the reply that asked, not under it. |
| + |
| +| File | Context | Text | |
| +|---|---|---| |
| +| ask_oficina.go | PENDING: the person's line Base sends once Oficina is connected from the chat; it shows as their own message, and the Assistant reads it as the go-ahead to carry on with what they asked | I've connected Oficina. Go ahead. | |
diff --git a/internal/browsertest/edge_ring_test.go b/internal/browsertest/edge_ring_test.go| new file mode 100644 |
| index 0000000..ee143c7 |
| --- /dev/null |
| +++ b/internal/browsertest/edge_ring_test.go |
| @@ -0,0 +1,133 @@ |
| +//go:build browser |
| + |
| +package browsertest |
| + |
| +import ( |
| + "bytes" |
| + "encoding/json" |
| + "fmt" |
| + "image/png" |
| + "strconv" |
| + "testing" |
| + "time" |
| + |
| + "github.com/chromedp/chromedp" |
| + |
| + "amadan.net/rastrillo/rastrillo/harness" |
| +) |
| + |
| +// plainCompositeJS lays a sheet over the page that sets every mask layer |
| +// of the composer's edge and the thinking bubble's back to the default |
| +// compositing (add), as Safari ended up with (Paul's screenshot, |
| +// 2026-11-19: the conic gradient over the whole field). An edge that only |
| +// shows as an edge through mask-composite: exclude fills the field then. |
| +// on false takes the sheet away. hide also hides the edge itself, for a |
| +// picture of what is under it. |
| +func edgeSheetJS(plain, hide bool) string { |
| + css := "" |
| + if plain { |
| + css += `.composer .field::after, .msg.thinking::before, .msg.answered::before { -webkit-mask-composite: source-over !important; mask-composite: add !important; }` |
| + } |
| + if hide { |
| + css += `.composer .field::after, .msg.thinking::before, .msg.answered::before { visibility: hidden !important; }` |
| + } |
| + return `(() => { const s = new CSSStyleSheet(); s.replaceSync(` + strconv.Quote(css) + `); document.adoptedStyleSheets = [s]; })()` |
| +} |
| + |
| +// rgbAt is the colour at CSS pixel (x, y) of a screenshot taken at dpr. |
| +func rgbAt(t *testing.T, shot []byte, dpr, x, y float64) [3]int { |
| + t.Helper() |
| + img, err := png.Decode(bytes.NewReader(shot)) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + r, g, b, _ := img.At(int(x*dpr), int(y*dpr)).RGBA() |
| + return [3]int{int(r >> 8), int(g >> 8), int(b >> 8)} |
| +} |
| + |
| +func apart(a, b [3]int) int { |
| + d := 0 |
| + for i := range a { |
| + if a[i] > b[i] { |
| + d += a[i] - b[i] |
| + } else { |
| + d += b[i] - a[i] |
| + } |
| + } |
| + return d |
| +} |
| + |
| +type box struct{ X, Y, W, H float64 } |
| + |
| +func boxOf(t *testing.T, rig *harness.Rig, sel string) box { |
| + t.Helper() |
| + var b box |
| + js := `(() => { const r = document.querySelector(` + strconv.Quote(sel) + `).getBoundingClientRect(); return JSON.stringify({X: r.left, Y: r.top, W: r.width, H: r.height}); })()` |
| + if err := json.Unmarshal([]byte(harness.Evaluate[string](rig, js)), &b); err != nil { |
| + t.Fatal(err) |
| + } |
| + return b |
| +} |
| + |
| +// shotWith takes a screenshot with the edge sheet given. |
| +func shotWith(t *testing.T, rig *harness.Rig, plain, hide bool) []byte { |
| + t.Helper() |
| + drive(t, rig, chromedp.Evaluate[chromedp.Void](edgeSheetJS(plain, hide)), chromedp.Sleep(150*time.Millisecond)) |
| + return harness.Read(rig, chromedp.CaptureScreenshot()) |
| +} |
| + |
| +// The composer's focus edge and the thinking bubble's edge are edges: the |
| +// gradient shows in a thin ring round the field (and the bubble) and never |
| +// over what is inside, whatever the browser does with mask compositing. |
| +// The pictures are compared with the edge hidden, everything held still |
| +// (reduced motion), in both themes; the edge itself must still show. |
| +func TestAskEdgeLeavesTheFieldClear(t *testing.T) { |
| + rig, f := askBase(t) |
| + th := thinking{t, rig, f} |
| + dpr := 1.0 |
| + for _, scheme := range []string{"light", "dark"} { |
| + for _, plain := range []bool{false, true} { |
| + name := fmt.Sprintf("%s, plain compositing %v", scheme, plain) |
| + drive(t, rig, reducedMotion(scheme, true)) |
| + openPanel(t, rig) |
| + drive(t, rig, chromedp.Evaluate[chromedp.Void](`document.querySelector("#ask-text").focus()`)) |
| + th.wait(`getComputedStyle(document.querySelector("#ask-text").parentElement, "::after").opacity === "1"`) |
| + dpr = harness.Evaluate[float64](rig, `window.devicePixelRatio`) |
| + field := boxOf(t, rig, "#ask-panel .composer .field") |
| + under, over := shotWith(t, rig, plain, true), shotWith(t, rig, plain, false) |
| + if plain { |
| + viewportShot(t, rig, "edge-plain-compositing-"+scheme) |
| + } |
| + // Inside the field, right of the placeholder: untouched. |
| + ix, iy := field.X+field.W*0.6, field.Y+field.H/2 |
| + if d := apart(rgbAt(t, under, dpr, ix, iy), rgbAt(t, over, dpr, ix, iy)); d > 12 { |
| + t.Errorf("%s: the edge paints over the field: %v under it, %v with it", name, |
| + rgbAt(t, under, dpr, ix, iy), rgbAt(t, over, dpr, ix, iy)) |
| + } |
| + // On the ring, 2px above the field's top: the edge shows. |
| + ex, ey := field.X+field.W/2, field.Y-2 |
| + if d := apart(rgbAt(t, under, dpr, ex, ey), rgbAt(t, over, dpr, ex, ey)); d < 60 { |
| + t.Errorf("%s: no edge round the field: %v under it, %v with it", name, |
| + rgbAt(t, under, dpr, ex, ey), rgbAt(t, over, dpr, ex, ey)) |
| + } |
| + |
| + // The thinking bubble's edge (still, with reduced motion: a |
| + // gradient on its ::before). |
| + drive(t, rig, chromedp.Evaluate[chromedp.Void](edgeSheetJS(false, false))) |
| + th.send("Can you make me a website?") |
| + drive(t, rig, chromedp.Evaluate[chromedp.Void](`document.activeElement.blur()`), chromedp.Sleep(500*time.Millisecond)) |
| + bub := boxOf(t, rig, thinkingSel) |
| + under, over = shotWith(t, rig, plain, true), shotWith(t, rig, plain, false) |
| + // In its left padding, clear of the dots and of the 1.5px ring. |
| + bx, by := bub.X+7, bub.Y+bub.H/2 |
| + if d := apart(rgbAt(t, under, dpr, bx, by), rgbAt(t, over, dpr, bx, by)); d > 12 { |
| + t.Errorf("%s: the thinking edge paints over the bubble: %v under it, %v with it", name, |
| + rgbAt(t, under, dpr, bx, by), rgbAt(t, over, dpr, bx, by)) |
| + } |
| + drive(t, rig, chromedp.Evaluate[chromedp.Void](edgeSheetJS(false, false)), |
| + chromedp.Click(chromedp.CSS(`#ask-panel form.composer button.stop`))) |
| + th.wait(`!document.querySelector("#ask-panel .thinking")`) |
| + } |
| + } |
| + drive(t, rig, reducedMotion("dark", false)) |
| +} |
diff --git a/internal/browsertest/oficina_resume_test.go b/internal/browsertest/oficina_resume_test.go| new file mode 100644 |
| index 0000000..4015f8a |
| --- /dev/null |
| +++ b/internal/browsertest/oficina_resume_test.go |
| @@ -0,0 +1,117 @@ |
| +//go:build browser |
| + |
| +package browsertest |
| + |
| +import ( |
| + "net/url" |
| + "regexp" |
| + "strconv" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "github.com/chromedp/chromedp" |
| + |
| + "amadan.net/rastrillo/rastrillo/harness" |
| + |
| + "amadan.net/carlos/base/internal/equipo/equipotest" |
| +) |
| + |
| +const resumeText = "I've connected Oficina. Go ahead." |
| + |
| +// personSends counts the person's messages Base sent to Equipo. |
| +func personSends(f *equipotest.Fake) int { |
| + n := 0 |
| + for _, c := range f.Calls("/api/v1/assistant/messages") { |
| + if c.Method == "POST" { |
| + n++ |
| + } |
| + } |
| + return n |
| +} |
| + |
| +// threadJS is the conversation, one line per item: its kind and its words. |
| +const threadJS = `[...document.querySelectorAll("#ask-panel .thread > li")].map((li) => |
| + (li.matches(".ask-notice") ? "note" : li.matches(".thinking") ? "thinking" : li.matches(".person") ? "person" : li.matches(".connect-offer") ? "offer" : "assistant") |
| + + ": " + li.textContent.trim()).join("\n")` |
| + |
| +// Back from connecting Oficina in the chat, the conversation goes on by |
| +// itself: the person's line saying so, then the Assistant thinking (its |
| +// spark bubble and dots) and answering what they asked. Once: a reload |
| +// sends nothing more. Turned down, nothing is sent; the chat says so in |
| +// the conversation, after the reply that asked, and what comes later goes |
| +// below the note. |
| +func TestAskOficinaResumesAfterConnect(t *testing.T) { |
| + rig, f := askBase(t) |
| + th := thinking{t, rig, f} |
| + openPanel(t, rig) |
| + f.Reply = func(string) string { return "Connect Oficina so I can add it to your calendar." } |
| + drive(t, rig, chromedp.SendKeys(chromedp.CSS(`#ask-text`), "Add getting coffee at 9:30 today\r")) |
| + th.wait(`document.querySelectorAll("#ask-panel .thread > li.msg.coordinator:not(.thinking):not(.draft)").length === 1 && |
| + document.querySelector("#ask-panel form.composer button.stop").hidden`) |
| + f.RaiseConnect("", rig.Origin+"/ask/oficina/connect") |
| + th.wait(`!!document.querySelector("#ask-panel .thread a.connect-btn")`) |
| + before := personSends(f) |
| + |
| + // Connected: Base sends the person's line and the Assistant works on it. |
| + f.Hold = true |
| + done := rig.Origin + "/ask/oficina/done?" + url.Values{"oficina_state": {strings.Repeat("s", 12)}, "oficina_code": {strings.Repeat("c", 12)}}.Encode() |
| + drive(t, rig, chromedp.Navigate(done), chromedp.WaitVisible(chromedp.CSS(`#ask-panel textarea`)), |
| + chromedp.Poll[chromedp.Void](readJS, chromedp.WithPollingTimeout(5*time.Second))) |
| + th.wait(`!!document.querySelector(` + strconv.Quote(thinkingSel+" .dots") + `)`) |
| + if n := personSends(f); n != before+1 { |
| + t.Fatalf("sent %d messages on connecting, want 1", n-before) |
| + } |
| + got := th.eval(threadJS) |
| + if !strings.HasSuffix(got, "person: "+resumeText+"\nthinking: ") || strings.Contains(got, "note:") { |
| + t.Errorf("after connecting, the conversation is:\n%s", got) |
| + } |
| + if harness.Evaluate[string](rig, `location.pathname + location.search`) != "/" { |
| + t.Errorf("the return address stays in the address bar") |
| + } |
| + viewportShot(t, rig, "oficina-resume-thinking") |
| + |
| + // A reload sends nothing more, and still shows the Assistant at work. |
| + openPanel(t, rig) |
| + th.wait(`!!document.querySelector(` + strconv.Quote(thinkingSel) + `)`) |
| + if n := personSends(f); n != before+1 { |
| + t.Errorf("a reload sent again: %d", n-before) |
| + } |
| + if n := strings.Count(th.eval(threadJS), resumeText); n != 1 { |
| + t.Errorf("the person's line shows %d times", n) |
| + } |
| + // The Assistant answers in place. |
| + m := regexp.MustCompile(`^/ask/turns/([^/]+)/cancel$`).FindStringSubmatch(th.eval(`document.querySelector("#ask-panel form.cancel").getAttribute("action")`)) |
| + if m == nil { |
| + t.Fatal("no turn running") |
| + } |
| + f.Answer(m[1], "Added “Getting coffee” to your calendar today, 9:30–10:30 am.", false) |
| + th.wait(`!document.querySelector("#ask-panel .thinking") && document.querySelector("#ask-panel .thread > li:last-child").textContent.startsWith("Added")`) |
| + f.Hold = false |
| + |
| + // Turned down (or cancelled): nothing is sent; the note follows the |
| + // reply that asked, and the next exchange goes below it. |
| + f.Reply = func(string) string { return "Connect Oficina so I can add it to your calendar." } |
| + drive(t, rig, chromedp.SendKeys(chromedp.CSS(`#ask-text`), "Add lunch at 1\r")) |
| + // The reply has landed and its turn ended (Stop gone), so Equipo has it. |
| + th.wait(`[...document.querySelectorAll("#ask-panel .thread > li.msg.coordinator:not(.thinking):not(.draft)")].length === 3 && |
| + document.querySelector("#ask-panel form.composer button.stop").hidden`) |
| + sent := personSends(f) |
| + drive(t, rig, chromedp.Navigate(rig.Origin+"/ask/oficina/done?oficina=denied"), chromedp.WaitVisible(chromedp.CSS(`#ask-panel textarea`)), |
| + chromedp.Poll[chromedp.Void](readJS, chromedp.WithPollingTimeout(5*time.Second)), chromedp.Sleep(300*time.Millisecond)) |
| + if n := personSends(f); n != sent { |
| + t.Errorf("turning it down sent %d messages", n-sent) |
| + } |
| + if got := th.eval(threadJS); !strings.HasSuffix(got, "assistant: Connect Oficina so I can add it to your calendar.\nnote: Oficina wasn't connected.") || |
| + strings.Contains(got, "thinking:") { |
| + t.Errorf("after turning it down, the conversation is:\n%s", got) |
| + } |
| + f.Reply = func(string) string { return "Nothing else today." } |
| + drive(t, rig, chromedp.SendKeys(chromedp.CSS(`#ask-text`), "What else is on?\r")) |
| + th.wait(`document.querySelector("#ask-panel .thread > li:last-child").textContent.startsWith("Nothing else today.")`) |
| + got = th.eval(threadJS) |
| + if !strings.Contains(got, "note: Oficina wasn't connected.\nperson: What else is on?\nassistant: Nothing else today.") { |
| + t.Errorf("later lines do not follow the note:\n%s", got) |
| + } |
| + viewportShot(t, rig, "oficina-note-in-conversation") |
| +} |
diff --git a/internal/browsertest/thinking_test.go b/internal/browsertest/thinking_test.go| index ff99958..47348f0 100644 |
| --- a/internal/browsertest/thinking_test.go |
| +++ b/internal/browsertest/thinking_test.go |
| @@ -304,7 +304,7 @@ func TestAskComposerFocusEdge(t *testing.T) { |
| openPanel(t, rig) |
| edge := `(() => { const ta = document.querySelector("#ask-text"), s = getComputedStyle(ta), e = getComputedStyle(ta.parentElement, "::after"); |
| return [document.activeElement === ta, e.opacity, s.outlineStyle, s.boxShadow !== "none", s.animationName, e.animationName, e.animationPlayState, |
| - /conic-gradient/.test(e.backgroundImage), e.paddingTop, e.top, document.querySelectorAll("#ask-panel form.composer canvas, #ask-panel form.composer .spark").length].join(" "); })()` |
| + /conic-gradient/.test(e.backgroundImage), e.getPropertyValue("--ring").trim(), e.top, document.querySelectorAll("#ask-panel form.composer canvas, #ask-panel form.composer .spark").length].join(" "); })()` |
| drive(t, rig, chromedp.Evaluate[chromedp.Void](`document.querySelector("#ask-text").focus()`)) |
| th.wait(`getComputedStyle(document.querySelector("#ask-text").parentElement, "::after").opacity === "1"`) |
| if got, want := th.eval(edge), "true 1 none true breathe-glow edge-turn running true 2px -3px 0"; got != want { |
diff --git a/internal/equipo/equipotest/chat.go b/internal/equipo/equipotest/chat.go| index 2fc1a3b..00606a8 100644 |
| --- a/internal/equipo/equipotest/chat.go |
| +++ b/internal/equipo/equipotest/chat.go |
| @@ -770,6 +770,22 @@ func (f *Fake) oficinaFinish(w http.ResponseWriter, r *http.Request) { |
| if finish == "" { |
| finish = "connected" |
| } |
| + if finish == "connected" { |
| + f.settleConnect() |
| + } |
| writeJSON(w, 200, map[string]string{"status": finish}) |
| } |
| } |
| + |
| +// settleConnect resolves the open connect cards, as Equipo does once the |
| +// person has connected. |
| +func (f *Fake) settleConnect() { |
| + f.cmu.Lock() |
| + defer f.cmu.Unlock() |
| + for _, c := range f.cards { |
| + if c.Kind == equipo.CardConnect && c.State == "open" { |
| + c.State, c.Revision = "resolved", c.Revision+1 |
| + f.emit("card", "card", c.ID, c.Revision, "", *c) |
| + } |
| + } |
| +} |
diff --git a/internal/look/static/app.css b/internal/look/static/app.css| index 4369ef2..d2bdb3e 100644 |
| --- a/internal/look/static/app.css |
| +++ b/internal/look/static/app.css |
| @@ -691,7 +691,11 @@ aside.ask-panel { position: absolute; top: 16px; right: 16px; bottom: 16px; widt |
| .connect-offer .connect-line { margin: 0 0 0 8px; color: var(--haze); font-size: 13.5px; line-height: 1.4; } |
| .connect-offer .connect-done { margin: 0; display: inline-flex; align-items: center; gap: 6px; color: var(--haze); font-size: 14px; font-weight: 500; } |
| .connect-done svg { width: 16px; height: 16px; fill: none; stroke: var(--focus); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; } |
| -.ask-empty, .ask-problem, .ask-notice { margin: 0; padding: 0 20px 12px; color: var(--haze); font-size: 14px; } |
| +.ask-empty, .ask-problem { margin: 0; padding: 0 20px 12px; color: var(--haze); font-size: 14px; } |
| +/* A note in the conversation (how connecting Oficina went): a quiet line |
| + on the Assistant's side, after the reply it follows, lined up with the |
| + bubbles' words. */ |
| +.thread > .ask-notice { align-self: flex-start; padding: 0 14px; color: var(--haze); font-size: 14px; } |
| .ask-foot { display: flex; align-items: center; gap: 10px; padding: 0 16px; } |
| .ask-status { flex: 1; margin: 0; min-height: 1.5em; color: var(--haze); font-size: 14px; } |
| .ask-status:empty { min-height: 0; } |
| @@ -712,20 +716,38 @@ aside.ask-panel { position: absolute; top: 16px; right: 16px; bottom: 16px; widt |
| .composer .send svg { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; } |
| .composer .stop svg { fill: currentColor; } |
| @keyframes pop { from { opacity: 0; transform: scale(.6); } } |
| +/* An edge, not a fill: the composer's focus edge and the thinking bubble's |
| + paint a gradient over their whole box and show it only through this mask, |
| + --ring thick round the box's edge and following its corners (--r-tl, |
| + --r-tr, --r-br, --r-bl, the box's own radii): a strip along each side |
| + and a quarter ring at each corner. The layers only add up, the default |
| + in every browser, so it needs no mask-composite, which Safari got wrong |
| + (the whole gradient filled the field). The outer edge is the box's own |
| + rounded clip. (The masks are black: only their alpha counts.) */ |
| +.composer .field::after, .msg.thinking::before, .msg.answered::before { |
| + --ring-in-tl: calc(var(--r-tl) - var(--ring)); --ring-in-tr: calc(var(--r-tr) - var(--ring)); |
| + --ring-in-br: calc(var(--r-br) - var(--ring)); --ring-in-bl: calc(var(--r-bl) - var(--ring)); |
| + --ring-mask: |
| + linear-gradient(black 0 0) top / 100% var(--ring) no-repeat, linear-gradient(black 0 0) bottom / 100% var(--ring) no-repeat, |
| + linear-gradient(black 0 0) left / var(--ring) 100% no-repeat, linear-gradient(black 0 0) right / var(--ring) 100% no-repeat, |
| + radial-gradient(circle at 100% 100%, transparent calc(var(--ring-in-tl) - .5px), black calc(var(--ring-in-tl) + .5px)) left top / var(--r-tl) var(--r-tl) no-repeat, |
| + radial-gradient(circle at 0 100%, transparent calc(var(--ring-in-tr) - .5px), black calc(var(--ring-in-tr) + .5px)) right top / var(--r-tr) var(--r-tr) no-repeat, |
| + radial-gradient(circle at 0 0, transparent calc(var(--ring-in-br) - .5px), black calc(var(--ring-in-br) + .5px)) right bottom / var(--r-br) var(--r-br) no-repeat, |
| + radial-gradient(circle at 100% 0, transparent calc(var(--ring-in-bl) - .5px), black calc(var(--ring-in-bl) + .5px)) left bottom / var(--r-bl) var(--r-bl) no-repeat; |
| + -webkit-mask: var(--ring-mask); mask: var(--ring-mask); } |
| /* The composer's focus, in place of the outline: a thin luminous edge |
| outside the field, teal into violet, that fades in and drifts round (a |
| turn every 6s), over a soft glow that breathes (4.5s). Only the glow |
| breathes: the 2px edge stays at full strength, so it is a real focus |
| - indicator. (The masks are black: only their alpha counts.) */ |
| + indicator. */ |
| @property --edge-turn { syntax: "<angle>"; inherits: false; initial-value: 0deg; } |
| @property --breath { syntax: "<number>"; inherits: false; initial-value: 0; } |
| .composer textarea.input:focus-visible { outline: none; animation: breathe-glow 2.25s cubic-bezier(.37,0,.63,1) infinite alternate; |
| box-shadow: 0 0 calc(15px + 6px * var(--breath)) calc(-4px + 3px * var(--breath)) color-mix(in srgb, var(--edge-glow-a) calc(55% + 35% * var(--breath)), transparent), |
| 0 0 calc(26px + 8px * var(--breath)) calc(-7px + 3px * var(--breath)) color-mix(in srgb, var(--edge-glow-b) calc(55% + 35% * var(--breath)), transparent); } |
| @keyframes breathe-glow { to { --breath: 1; } } |
| -.composer .field::after { content: ""; position: absolute; inset: -3px; padding: 2px; border-radius: 13px; pointer-events: none; opacity: 0; transition: opacity .35s ease; |
| - -webkit-mask: linear-gradient(black 0 0) content-box, linear-gradient(black 0 0); -webkit-mask-composite: xor; |
| - mask: linear-gradient(black 0 0) content-box exclude, linear-gradient(black 0 0); |
| +.composer .field::after { content: ""; position: absolute; inset: -3px; border-radius: 13px; pointer-events: none; opacity: 0; transition: opacity .35s ease; |
| + --ring: 2px; --r-tl: 13px; --r-tr: 13px; --r-br: 13px; --r-bl: 13px; |
| animation: edge-turn 6s linear infinite paused; |
| background: conic-gradient(from var(--edge-turn), var(--edge-a), var(--edge-hi) 9%, var(--edge-a) 20%, var(--edge-b) 50%, var(--edge-a)) border-box; } |
| .composer .field:has(textarea:focus-visible)::after { opacity: 1; animation-play-state: running; } |
| @@ -744,10 +766,9 @@ aside.ask-panel { position: absolute; top: 16px; right: 16px; bottom: 16px; widt |
| @property --sweep { syntax: "<angle>"; inherits: false; initial-value: 0deg; } |
| .msg.thinking, .msg.answered { position: relative; } |
| .msg .spark { position: absolute; left: -8px; top: -8px; width: calc(100% + 16px); height: calc(100% + 16px); pointer-events: none; } |
| -.msg.thinking::before, .msg.answered::before { content: ""; position: absolute; inset: 0; padding: 1.5px; border-radius: inherit; pointer-events: none; opacity: 0; |
| +.msg.thinking::before, .msg.answered::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; |
| transition: opacity .35s ease; |
| - -webkit-mask: linear-gradient(black 0 0) content-box, linear-gradient(black 0 0); -webkit-mask-composite: xor; |
| - mask: linear-gradient(black 0 0) content-box exclude, linear-gradient(black 0 0); |
| + --ring: 1.5px; --r-tl: 14px; --r-tr: 14px; --r-br: 14px; --r-bl: 4px; /* .msg.coordinator's corners */ |
| background: conic-gradient(from var(--sweep), transparent 0 50%, color-mix(in srgb, var(--spk-amber) 60%, transparent) 64%, |
| var(--spk-rose) 76%, var(--edge-b) 88%, var(--edge-a) 98%, var(--edge-hi)) border-box; } |
| .msg.thinking.no-gl::before { opacity: 1; animation: sweep 4s linear infinite; } |
| @@ -839,7 +860,7 @@ main { min-height: 100dvh; } |
| aside.ask-panel .ask-head h2 { font-size: 18px; } |
| aside.ask-panel .composer { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); } |
| aside.ask-panel .ask-foot { padding: 0 8px; } |
| - aside.ask-panel .ask-empty, aside.ask-panel .ask-problem, aside.ask-panel .ask-notice { padding: 0 12px 12px; } |
| + aside.ask-panel .ask-empty, aside.ask-panel .ask-problem { padding: 0 12px 12px; } |
| aside.ask-panel .thread { padding: 14px 12px; } |
| aside.ask-panel .msg { max-width: 92%; } |
| } |
diff --git a/internal/look/static/ask.js b/internal/look/static/ask.js| index ba5b1f9..169b72b 100644 |
| --- a/internal/look/static/ask.js |
| +++ b/internal/look/static/ask.js |
| @@ -83,6 +83,22 @@ function start(root) { |
| return id ? thread.querySelector(`[${attr}="${CSS.escape(id)}"]`) : null; |
| } |
| + // The note Home drew for this visit (how connecting Oficina went) stays |
| + // where it was said, after the line it followed (data-after): a fresh |
| + // read puts it back there, and what comes later goes below it. Once its |
| + // line is gone from the conversation, so is the note. |
| + const notice = thread.querySelector(":scope > .ask-notice"); |
| + function placeNotice() { |
| + if (!notice) return; |
| + const after = notice.dataset.after; |
| + const at = after ? item("data-id", after) : [...thread.querySelectorAll(":scope > li.msg[data-id]")].pop(); |
| + if (at) { |
| + at.after(notice); |
| + notice.dataset.after = at.dataset.id; |
| + } else if (after) notice.remove(); |
| + else thread.prepend(notice); |
| + } |
| + |
| // A message, once: the Assistant's reply takes its streamed draft's |
| // place, or becomes its thinking bubble, where it is (once a glance has |
| // had its time, see held). |
| @@ -1440,6 +1456,7 @@ function start(root) { |
| waits.clear(); |
| pinned = true; |
| s.messages.forEach(addMessage); |
| + placeNotice(); |
| for (const j of s.jobs || []) { |
| addJob(j); |
| (j.cards || []).forEach(addCard); |
diff --git a/internal/web/ask.go b/internal/web/ask.go| index 6540eaf..2723ab3 100644 |
| --- a/internal/web/ask.go |
| +++ b/internal/web/ask.go |
| @@ -186,7 +186,8 @@ type askView struct { |
| // Equipo was slow to answer): drawn without saying it is empty, for |
| // the panel's script to read. |
| Unread bool |
| - // Notice is a line the chat says once (how connecting Oficina ended). |
| + // Notice is a line the chat says once (how connecting Oficina ended), |
| + // in the conversation after its newest line (NoticeAfter). |
| Notice string |
| // base is Base's own origin: the only place a connect-Oficina link may |
| // go and keep its rel. |
| @@ -196,6 +197,15 @@ type askView struct { |
| offerAt string |
| } |
| +// NoticeAfter is the id of the line the notice follows: the newest |
| +// message, "" when there is none. |
| +func (v askView) NoticeAfter() string { |
| + if len(v.Messages) == 0 { |
| + return "" |
| + } |
| + return v.Messages[len(v.Messages)-1].ID |
| +} |
| + |
| // connectOffer is an open connect card as the chat draws it: a button, |
| // going to Base's own connect page, at the end of the Assistant's newest |
| // reply. The snapshot does not say which turn raised a card, so a fresh |
diff --git a/internal/web/ask_oficina.go b/internal/web/ask_oficina.go| index 4ac35ec..6086fdc 100644 |
| --- a/internal/web/ask_oficina.go |
| +++ b/internal/web/ask_oficina.go |
| @@ -1,6 +1,8 @@ |
| package web |
| import ( |
| + "crypto/sha256" |
| + "encoding/hex" |
| "errors" |
| "net/http" |
| "net/url" |
| @@ -30,6 +32,11 @@ var oficinaNotes = map[string]string{ |
| "unavailable": "Couldn't reach Oficina. Try again later.", |
| } |
| +// oficinaResume is what Base sends for the person once Oficina is |
| +// connected from the chat, so the Assistant goes on with what they asked |
| +// (PENDING copy: docs/copy-pending.md, oficina.resume). |
| +const oficinaResume = "I've connected Oficina. Go ahead." |
| + |
| // quiet marks a response as one no cache keeps and no Referer follows: its |
| // URL may carry a code. |
| func quiet(w http.ResponseWriter) { |
| @@ -73,17 +80,37 @@ func (a *app) oficinaBearer(w http.ResponseWriter, r *http.Request) (askConn, bo |
| // ("" says nothing), and the chat open so they see it. |
| func (a *app) oficinaBack(w http.ResponseWriter, r *http.Request, me store.Member, outcome string) { |
| if _, ok := oficinaNotes[outcome]; ok { |
| - if me.AskClosed { |
| - if err := store.SetAskClosed(r.Context(), a.db, me.ID, false); err != nil { |
| - a.logger.Error("ask: dock", "err", err) |
| - } |
| - } |
| + a.oficinaDock(r, me) |
| http.SetCookie(w, &http.Cookie{Name: oficinaNote, Value: outcome, Path: "/", MaxAge: 120, |
| HttpOnly: true, Secure: strings.HasPrefix(a.cfg.Origin, "https://"), SameSite: http.SameSiteLaxMode}) |
| } |
| http.Redirect(w, r, "/", http.StatusSeeOther) |
| } |
| +// oficinaDock opens the member's docked chat, so they see what happened. |
| +func (a *app) oficinaDock(r *http.Request, me store.Member) { |
| + if me.AskClosed { |
| + if err := store.SetAskClosed(r.Context(), a.db, me.ID, false); err != nil { |
| + a.logger.Error("ask: dock", "err", err) |
| + } |
| + } |
| +} |
| + |
| +// oficinaResumed goes on with the conversation once Oficina is connected: |
| +// it sends oficinaResume for the person, so the Assistant answers what |
| +// they asked now that it can, and reports whether Equipo took it. Only a |
| +// finished consent comes here, and its key is the consent's own (a hash |
| +// of its state), so a second return with the same consent sends nothing |
| +// more: Equipo keeps one message per key. |
| +func (a *app) oficinaResumed(r *http.Request, c askConn, state string) bool { |
| + sum := sha256.Sum256([]byte("base.oficina.resume\x00" + state)) |
| + if _, err := a.ask.client.Send(r.Context(), c.token, oficinaResume, "oficina-"+hex.EncodeToString(sum[:20])); err != nil { |
| + a.logger.Warn("ask: oficina resume", "err", err) |
| + return false |
| + } |
| + return true |
| +} |
| + |
| // oficinaLost handles Equipo refusing the bearer: reconnect. |
| func (a *app) oficinaFailed(w http.ResponseWriter, r *http.Request, c askConn, err error) { |
| if errors.Is(err, equipo.ErrUnauthenticated) { |
| @@ -143,6 +170,13 @@ func (a *app) askOficinaDone(w http.ResponseWriter, r *http.Request) { |
| if _, known := oficinaNotes[status]; !known { |
| status = "unavailable" |
| } |
| + // Connected: the chat goes on, and says so by doing it; the note is |
| + // for when it could not. |
| + if status == "connected" && a.oficinaResumed(r, c, state) { |
| + a.oficinaDock(r, c.me) |
| + http.Redirect(w, r, "/", http.StatusSeeOther) |
| + return |
| + } |
| a.oficinaBack(w, r, c.me, status) |
| } |
diff --git a/internal/web/templates/partials/chat.html b/internal/web/templates/partials/chat.html| index c7a2e3c..56be999 100644 |
| --- a/internal/web/templates/partials/chat.html |
| +++ b/internal/web/templates/partials/chat.html |
| @@ -43,19 +43,19 @@ |
| <div class="ask-chat" data-when="ready norunner oldrunner"{{if not (.Shows "ready norunner oldrunner")}} hidden{{end}}> |
| <div class="log"><ol class="thread" role="log" aria-label="Conversation"{{with .Zone}} data-zone="{{.}}"{{end}} data-mark="{{asset "static/oficina/equipo.svg"}}"> |
| {{range .Messages}}{{if eq .Role "person"}}<li class="msg person" data-id="{{.ID}}">{{.Text}}</li>{{else}}<li class="msg coordinator" data-id="{{.ID}}">{{$.Rich .Text}}{{range $.OffersAt .ID}}<div class="connect-offer" data-card="{{.ID}}" data-revision="{{.Revision}}">{{template "ask-offer" .}}</div>{{end}}</li>{{end}} |
| +{{end}}{{with .Notice}}<li class="ask-notice" data-after="{{$.NoticeAfter}}">{{.}}</li> |
| {{end}}{{range .Jobs}}{{template "ask-job" .}} |
| {{end}}{{range .LooseCards}}{{template "ask-card" .}} |
| {{end}}{{range .LooseOffers}}<li class="connect-offer loose" data-card="{{.ID}}" data-revision="{{.Revision}}">{{template "ask-offer" .}}</li> |
| {{end}}</ol> |
| <button class="jump" type="button" hidden>Jump to latest</button></div> |
| -<p class="ask-empty" data-empty{{if or .Messages .Jobs .Cards .Unread}} hidden{{end}}>Ask about your work, or ask Base to get something done.</p> |
| +<p class="ask-empty" data-empty{{if or .Messages .Jobs .Cards .Unread .Notice}} hidden{{end}}>Ask about your work, or ask Base to get something done.</p> |
| {{with .Problem}}<p class="ask-problem" role="alert">{{.}}</p>{{end}} |
| -{{with .Notice}}<p class="ask-notice" role="status">{{.}}</p>{{end}} |
| {{/* Without a runner that can answer, the conversation shows and says so; what the person wrote stays in the field. */}}<p class="ask-problem ask-runner" data-when="norunner"{{if not (.Shows "norunner")}} hidden{{end}} role="alert">Ask Base isn't set up for you yet. <a href="{{.Equipo}}" target="_blank" rel="noopener">Finish setting it up</a>, then try again.</p> |
| <p class="ask-problem ask-runner" data-when="oldrunner"{{if not (.Shows "oldrunner")}} hidden{{end}} role="alert">Ask Base needs an update first. <a href="{{.Equipo}}" target="_blank" rel="noopener">Update it</a>, then try again.</p> |
| <div class="ask-foot"> |
| <p class="ask-status" role="status">{{.Status}}</p> |
| </div> |
| -{{/* The composer: Send (an arrow) and, while a turn runs, Stop (a square) sit inside the field's end. Stop posts the cancel form beside it. Without scripts Send always shows; the panel's script hides it while the field is empty, and while a turn runs. */}}<form class="cancel" id="ask-cancel" method="post" action="{{with .Turn}}/ask/turns/{{.ID}}/cancel{{else}}/ask{{end}}"><input type="hidden" name="key" value="{{newKey}}"></form> |
| -<form class="composer" method="post" action="/ask/messages"><input type="hidden" name="key" value="{{.Key}}"><label class="sr-only" for="ask-text">Message</label><div class="field"><textarea class="input" id="ask-text" name="text" rows="1" required maxlength="16000" placeholder="Ask Base anything">{{.Text}}</textarea><div class="actions"><button class="send" type="submit" aria-label="Send" title="Send"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 19V5M6 11l6-6 6 6"/></svg></button><button class="stop" type="submit" form="ask-cancel" aria-label="Stop" title="Stop"{{if not .Turn}} hidden{{end}}><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="6.5" y="6.5" width="11" height="11" rx="2"/></svg></button></div></div></form> |
| +{{/* The composer: Send (an arrow) and, while a turn runs, Stop (a square) sit inside the field's end. Stop posts the cancel form beside it. Without scripts Send always shows; the panel's script hides it while the field is empty, and while a turn runs. Password managers are told it is no login (autocomplete off, and 1Password's, LastPass's and Dashlane's own marks); spell-check and the keyboard are untouched. */}}<form class="cancel" id="ask-cancel" method="post" action="{{with .Turn}}/ask/turns/{{.ID}}/cancel{{else}}/ask{{end}}"><input type="hidden" name="key" value="{{newKey}}"></form> |
| +<form class="composer" method="post" action="/ask/messages"><input type="hidden" name="key" value="{{.Key}}"><label class="sr-only" for="ask-text">Message</label><div class="field"><textarea class="input" id="ask-text" name="text" rows="1" required maxlength="16000" placeholder="Ask Base anything" autocomplete="off" data-1p-ignore data-lpignore="true" data-form-type="other">{{.Text}}</textarea><div class="actions"><button class="send" type="submit" aria-label="Send" title="Send"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 19V5M6 11l6-6 6 6"/></svg></button><button class="stop" type="submit" form="ask-cancel" aria-label="Stop" title="Stop"{{if not .Turn}} hidden{{end}}><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="6.5" y="6.5" width="11" height="11" rx="2"/></svg></button></div></div></form> |
| </div>{{end}} |
diff --git a/internal/webtest/oficina_connect_test.go b/internal/webtest/oficina_connect_test.go| index f2a024f..14369b3 100644 |
| --- a/internal/webtest/oficina_connect_test.go |
| +++ b/internal/webtest/oficina_connect_test.go |
| @@ -126,13 +126,10 @@ func TestOficinaDoneFinishesWithTheBearer(t *testing.T) { |
| !strings.Contains(calls[0].Body, `"state":"`+st+`"`) || !strings.Contains(calls[0].Body, `"code":"`+code+`"`) { |
| t.Fatalf("calls: %+v", calls) |
| } |
| - // The outcome reaches the chat once, and nothing secret is logged. |
| - home := a.get("/") |
| - if !strings.Contains(home.Body, "Oficina connected.") { |
| - t.Fatalf("home lacks the note:\n%s", home.Body) |
| - } |
| - if again := a.get("/"); strings.Contains(again.Body, "Oficina connected.") { |
| - t.Errorf("the note showed twice") |
| + // The chat goes on with what the person asked, and nothing secret is |
| + // logged. |
| + if home := a.get("/"); !strings.Contains(strings.ReplaceAll(home.Body, "'", "'"), resumeText) { |
| + t.Fatalf("home lacks the resumed conversation:\n%s", home.Body) |
| } |
| for _, secret := range []string{st, code} { |
| if strings.Contains(a.logs.String(), secret) { |
| @@ -145,7 +142,7 @@ func TestOficinaDoneOutcomes(t *testing.T) { |
| a, f := newAskApp(t) |
| a.connectEquipo(f) |
| for _, c := range []struct{ finish, want string }{ |
| - {"connected", "Oficina connected."}, |
| + {"connected", resumeText}, |
| {"denied", "Oficina wasn't connected."}, |
| {"expired", "That link expired. Try again."}, |
| {"unavailable", "Couldn't reach Oficina. Try again later."}, |
| @@ -231,3 +228,153 @@ func TestOficinaConnectCardLinkKeepsItsRel(t *testing.T) { |
| t.Errorf("other link not opened in a new tab:\n%s", page) |
| } |
| } |
| + |
| +// resumeText is what Base sends for the person once Oficina is connected |
| +// from the chat, so the Assistant goes on with what they asked |
| +// (PENDING copy: docs/copy-pending.md). |
| +const resumeText = "I've connected Oficina. Go ahead." |
| + |
| +// sends are the person's messages Base sent to Equipo, oldest first. |
| +func sends(f *equipotest.Fake) []string { |
| + var out []string |
| + for _, c := range f.Calls("/api/v1/assistant/messages") { |
| + if c.Method == "POST" { |
| + out = append(out, c.Body) |
| + } |
| + } |
| + return out |
| +} |
| + |
| +// Connected from the chat, Base goes on with the conversation: it sends |
| +// one message for the person, with their bearer, so the Assistant answers |
| +// what they asked now that it can. Home shows it and the Assistant at |
| +// work, not the note. Home again, or the same return again, sends nothing |
| +// more. |
| +func TestOficinaDoneConnectedResumesOnce(t *testing.T) { |
| + a, f := newAskApp(t) |
| + token := a.connectEquipo(f) |
| + f.Hold = true |
| + if r := a.get(doneURL(fakeState(), fakeCode())); r.Code != 303 || r.Location() != "/" || strings.Contains(r.Header.Get("Set-Cookie"), "oficina_note") { |
| + t.Fatalf("done: %d %q %v", r.Code, r.Location(), r.Header) |
| + } |
| + calls := f.Calls("/api/v1/assistant/messages") |
| + if len(calls) != 1 || calls[0].Method != "POST" || calls[0].Header.Get("Authorization") != "Bearer "+token || |
| + !strings.Contains(calls[0].Body, `"text":"I've connected Oficina. Go ahead."`) { |
| + t.Fatalf("sends: %+v", calls) |
| + } |
| + home := strings.ReplaceAll(a.get("/").Body, "'", "'") |
| + if !strings.Contains(home, `<li class="msg person" data-id="`) || strings.Count(home, resumeText) != 1 { |
| + t.Fatalf("home lacks the person's line, once:\n%s", home) |
| + } |
| + if strings.Contains(home, "Oficina connected.") { |
| + t.Errorf("home says the note as well as going on") |
| + } |
| + if !strings.Contains(home, `<p class="ask-status" role="status">Thinking…</p>`) { |
| + t.Errorf("home does not show the Assistant at work") |
| + } |
| + a.get("/") |
| + // A second return with the same consent (a reload of the return |
| + // address that Equipo still took) sends under the same key: Equipo |
| + // keeps one message. |
| + a.get(doneURL(fakeState(), fakeCode())) |
| + if got := sends(f); len(got) > 2 || len(got) == 2 && got[0] != got[1] { |
| + t.Errorf("sent again: %v", got) |
| + } |
| + keys := map[string]bool{} |
| + for _, c := range f.Calls("/api/v1/assistant/messages") { |
| + keys[c.Header.Get("Idempotency-Key")] = true |
| + } |
| + if len(keys) != 1 { |
| + t.Errorf("the resumes went under %d keys", len(keys)) |
| + } |
| + if n := strings.Count(a.get("/ask/state").Body, "connected Oficina. Go ahead."); n != 1 { |
| + t.Errorf("the conversation has the person's line %d times", n) |
| + } |
| +} |
| + |
| +// Denied, cancelled, expired, unreachable, someone else's, or no code: |
| +// nothing is sent, and the chat says how it went. |
| +func TestOficinaDoneResumesOnlyWhenConnected(t *testing.T) { |
| + for _, finish := range []string{"denied", "expired", "unavailable", "surprise"} { |
| + a, f := newAskApp(t) |
| + a.connectEquipo(f) |
| + f.FinishWith(finish) |
| + a.get(doneURL(fakeState(), fakeCode())) |
| + a.get("/") |
| + if got := sends(f); len(got) != 0 { |
| + t.Errorf("%s: sent %v", finish, got) |
| + } |
| + } |
| + a, f := newAskApp(t) |
| + a.connectEquipo(f) |
| + for _, target := range []string{"/ask/oficina/done?oficina=denied", "/ask/oficina/done?oficina=connected", "/ask/oficina/done?oficina=expired", |
| + doneURL(equipotest.OtherPersonsState, fakeCode())} { |
| + a.get(target) |
| + a.get("/") |
| + } |
| + f.FailOficina(503, "unavailable") |
| + a.get(doneURL(fakeState(), fakeCode())) |
| + if got := sends(f); len(got) != 0 { |
| + t.Errorf("sent %v", got) |
| + } |
| +} |
| + |
| +// Connected, but the message could not go (no runner can answer): the |
| +// chat says it is connected, as before, and the person asks again. |
| +func TestOficinaDoneResumeFailsSaysConnected(t *testing.T) { |
| + a, f := newAskApp(t) |
| + a.connectEquipo(f) |
| + f.NoRunner() |
| + if r := a.get(doneURL(fakeState(), fakeCode())); r.Code != 303 || !strings.Contains(r.Header.Get("Set-Cookie"), "oficina_note=connected") { |
| + t.Fatalf("done: %d %v", r.Code, r.Header) |
| + } |
| + if home := a.get("/"); !strings.Contains(home.Body, "Oficina connected.") { |
| + t.Errorf("home lacks the note") |
| + } |
| +} |
| + |
| +// The note sits in the conversation, after the line it follows (the reply |
| +// that asked to connect), not under it: what comes later goes below it. |
| +func TestOficinaNoteSitsInTheConversation(t *testing.T) { |
| + a, f := newAskApp(t) |
| + a.connectEquipo(f) |
| + f.Say("Connect Oficina so I can add it to your calendar.") |
| + a.get("/ask/oficina/done?oficina=denied") |
| + home := strings.ReplaceAll(a.get("/").Body, "'", "'") |
| + thread := home[strings.Index(home, `<ol class="thread"`):] |
| + thread = thread[:strings.Index(thread, "</ol>")] |
| + reply := strings.Index(thread, "Connect Oficina so I can add it to your calendar.") |
| + note := strings.Index(thread, `<li class="ask-notice" data-after="m_`) |
| + if reply < 0 || note < reply || !strings.Contains(thread[note:], ">Oficina wasn't connected.</li>") { |
| + t.Fatalf("the note is not in the conversation after the reply:\n%s", home) |
| + } |
| + if strings.Contains(home, `<p class="ask-notice"`) { |
| + t.Errorf("the note is under the conversation too") |
| + } |
| +} |
| + |
| +// Password managers leave the composer alone (1Password put its icon over |
| +// it): it is a message, not a login. Spell-check and a phone's keyboard |
| +// keep working: nothing turns them off. |
| +func TestComposerIgnoredByPasswordManagers(t *testing.T) { |
| + a, f := newAskApp(t) |
| + a.connectEquipo(f) |
| + for _, path := range []string{"/", "/ask"} { |
| + page := a.get(path).Body |
| + i := strings.Index(page, `<textarea class="input" id="ask-text"`) |
| + if i < 0 { |
| + t.Fatalf("%s: no composer", path) |
| + } |
| + field := page[i : i+strings.Index(page[i:], ">")] |
| + for _, want := range []string{`autocomplete="off"`, `data-1p-ignore`, `data-lpignore="true"`, `data-form-type="other"`} { |
| + if !strings.Contains(field, want) { |
| + t.Errorf("%s: composer lacks %s: %s", path, want, field) |
| + } |
| + } |
| + for _, off := range []string{"spellcheck", "autocorrect", "autocapitalize", "inputmode"} { |
| + if strings.Contains(field, off) { |
| + t.Errorf("%s: composer sets %s: %s", path, off, field) |
| + } |
| + } |
| + } |
| +} |