oficina / calendar Public

wip: review fixes, rastrillo v0.45.0

claude agent, operated by paul@keymail.dev f5548c5067eb1d1e0e1627686c4b50a284d4dffa parent 250a501
18 files changed, +173 −47
  • AGENTS.md +18 −1
  • Makefile +5 −3
  • go.mod +2 −2
  • go.sum +2 −2
  • internal/calendar/auth.go +14 −1
  • internal/calendar/credits/notices.json +1 −1
  • internal/calendar/keymail_signin_test.go +1 −0
  • internal/calendar/signin_browser_test.go +1 −1
  • internal/calendar/signin_door_states_test.go +3 −2
  • internal/calendar/static/calendar.css +3 −11
  • internal/calendar/templates/book_gone.html +1 −1
  • internal/calendar/templates/book_manage.html +1 −1
  • internal/calendar/templates/event.html +1 −1
  • internal/calendar/templates/reminders.html +1 −1
  • internal/calendar/templates/share.html +1 −1
  • internal/calendar/testing.go +8 −0
  • internal/calendartest/main_test.go +3 −0
  • internal/calendartest/rhythm_browser_test.go +107 −18
diff --git a/AGENTS.md b/AGENTS.md
index 9911589..b64f468 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -226,6 +226,14 @@ relying on remembering one, make it a test instead.
`about:blank` without one. `TestBrowserWalk` drives now, but fails
at its first sign-in (no link is mailed after its form submit), and
is not in `make browser`; do not assume it ran.
+- `make browser` also runs `TestEveryScreenKeepsTheRhythm`: Fiesta's
+ rhythm audit over every screen at 1280 and 390px, through the
+ production stack, reading around the calendar grids. Every page but
+ the four views is Fiesta's stack (`<main rst-stack>`, layout.html):
+ a page adds no margins between its blocks, and its button rows are
+ `rst-actions`. `make spacing` (in `make ci`) holds every margin,
+ padding and gap in Calendar's CSS to `var(--rst-sp-N)` or a
+ `/* spacing-allow: why */`.
- **A control styled with `font: inherit` under a selector heavier than
a bare `input`** loses tokens.css's 16px-on-touch rule. Restate
`font-size: max(1rem, 1em)` for it under `(pointer: coarse)`, as
@@ -253,7 +261,16 @@ relying on remembering one, make it a test instead.
path, doctor compares nothing and `--fix` refuses**: copy the drifted
files out of the new module's `ui/` by hand, and
TestVendoredAssetsMatchTheLibrary says which. That is how v0.42.0 came
- in (smart door, 2026-11-22: tokens.css, select.js, datetime.js). The
+ in (smart door, 2026-11-22: tokens.css, select.js, datetime.js), and
+ v0.45.0 (the spacing rollout, 2026-11-22: tokens.css, which carries
+ Fiesta's stack).
+- **From v0.45.0 an unlisted Keymail server is dialed only at a public
+ address**, by a client rastrillo clones from `http.DefaultTransport`.
+ The tests' in-process Keymail fixtures (`keymailtest`) wrap that
+ transport, so the test mains list their servers with
+ `SetKeymailServersForTest` and auth reaches them through its
+ listed-servers guard. Deployments leave `KeymailServers` nil. The door
+ never names Keymail from v0.45.0: its words are rastrillo's. The
library's newer scripts (fiesta.js, live.js, anchor.js, light.js,
transition.js, copy.js) are not linked by the layout and are listed in
`vendoredIsMine` as deliberately absent. doctor's template checks are
diff --git a/Makefile b/Makefile
index 8e80f47..c88a23c 100644
--- a/Makefile
+++ b/Makefile
@@ -116,10 +116,12 @@ fmt-check:
# Fiesta's spacing check (Paul, 2026-11-22: no ad-hoc spacing): every
# margin, padding and gap in Calendar's own stylesheets is a
# var(--rst-sp-N), or says why not with /* spacing-allow: why */.
-# tokens.css is rastrillo's; theme, busy, chrome, menu, sky and base
-# are estilo's, written by scripts/writeestilo: neither is ours to space.
+# tokens.css is rastrillo's, re-copied on each upgrade, and not ours to
+# space. estilo's files (theme, busy, chrome, menu, sky, base, written by
+# scripts/writeestilo) are read too: they are on the scale, and a bump
+# that brings one that is not should fail here, not pass unseen.
spacing:
- go tool fiesta spacing -skip tokens.css -skip theme.css -skip busy.css -skip chrome.css -skip menu.css -skip sky.css -skip base.css internal/calendar/static
+ go tool fiesta spacing -skip tokens.css internal/calendar/static
# A step of its own, not folded into another target's recipe: ci.d/
# steps each exec one make target, so migration-check needs its own
diff --git a/go.mod b/go.mod
index bc8654c..4218aaf 100644
--- a/go.mod
+++ b/go.mod
@@ -7,7 +7,7 @@ toolchain go1.26.5
require (
amadan.net/oficina/home/connect v0.0.0-20261122114341-150d94e2370f
amadan.net/oficina/home/handoff v0.0.0-20261122114341-150d94e2370f
- amadan.net/rastrillo/rastrillo v0.44.1
+ amadan.net/rastrillo/rastrillo v0.45.0
github.com/carlosframework/rastrillo v0.23.0
github.com/chromedp/chromedp v0.21.0
github.com/go-chi/chi/v5 v5.3.2
@@ -43,11 +43,11 @@ require (
amadan.net/oficina/home/dashboard v0.0.0-20261024234842-3774eb68f816
amadan.net/oficina/home/roster v0.0.0-20261028171508-67c12e39a9d2
amadan.net/oficina/home/teammode v0.0.0-20261028171508-67c12e39a9d2
+ amadan.net/rastrillo/fiesta v1.6.1
amadan.net/rastrillo/native/server v0.0.0-20260923173546-2a5d07b2c8d3
)
require (
- amadan.net/rastrillo/fiesta v1.6.1 // indirect
amadan.net/rastrillo/rastrillo/money v0.1.0 // indirect
github.com/google/jsonschema-go v0.4.3 // indirect
github.com/modelcontextprotocol/go-sdk v1.8.0 // indirect
diff --git a/go.sum b/go.sum
index 77c4885..bc1e8ad 100644
--- a/go.sum
+++ b/go.sum
@@ -16,8 +16,8 @@ amadan.net/rastrillo/fiesta v1.6.1 h1:WYgHt652+uQj6eR0Y0JLin+XrdRPGk1WPW7o0lSrc9
amadan.net/rastrillo/fiesta v1.6.1/go.mod h1:LpO391W1dIRUxOIKklHm+bGyWXtlFyBRRPQCysb9LjY=
amadan.net/rastrillo/native/server v0.0.0-20260923173546-2a5d07b2c8d3 h1:5EFx7BLJj/+G/rt8bTmeyMWVfF5s5Sns7ajTvX4w/I8=
amadan.net/rastrillo/native/server v0.0.0-20260923173546-2a5d07b2c8d3/go.mod h1:ZaaxeE278dJltdrLwmwpxUjQ5wuKzqDAVSNRet+WupY=
-amadan.net/rastrillo/rastrillo v0.44.1 h1:7RNROXSmxr1m9Ax/siyPxS2DEjppIHAj/jWectdoxVQ=
-amadan.net/rastrillo/rastrillo v0.44.1/go.mod h1:0bufVMz8D4aWvxvJjehW70T8Jsvytrp1YEwoIzFTKm8=
+amadan.net/rastrillo/rastrillo v0.45.0 h1:zJfxetxg/H/CkCBFIvdGQbiATQ0hV3JR7H82AMk4bmM=
+amadan.net/rastrillo/rastrillo v0.45.0/go.mod h1:Vk7QL+RePyKtcP+7XclR9hpSDp/CjrVo37TENKifaFY=
amadan.net/rastrillo/rastrillo/money v0.1.0 h1:MxU4oqNrW8abxRTkgZBv24OYNpFnvonajNqeLIzmmaM=
amadan.net/rastrillo/rastrillo/money v0.1.0/go.mod h1:cmgkjBEIQh1pFSYvQk0UU6oPYS8kSDypdT9+t4Flx0U=
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
diff --git a/internal/calendar/auth.go b/internal/calendar/auth.go
index 9dd70f9..92ed731 100644
--- a/internal/calendar/auth.go
+++ b/internal/calendar/auth.go
@@ -242,10 +242,23 @@ func newAuthPlugin(origin string, writer *sql.DB, instanceKey string, mailer mai
// (schema, assets, a form that needs JavaScript).
ProofOff: true,
Subject: chrome.EmailSubject("Calendar"),
- Logger: logger,
+ // nil in every deployment: rastrillo's default, any server an
+ // address's own _keymail delegation names, dialed only at a
+ // public address. Only tests list servers (keymailTestServers).
+ KeymailServers: keymailTestServers,
+ Logger: logger,
})
}
+// keymailTestServers is rauth.Config.KeymailServers, and nil outside
+// tests. From rastrillo v0.45.0 an unlisted Keymail server is dialed only
+// at a public address, by a client cloned from http.DefaultTransport;
+// the tests' in-process Keymail fixtures (keymailtest) answer behind a
+// wrapped DefaultTransport at a name nothing resolves, so the test mains
+// list their host (SetKeymailServersForTest) and auth reaches them
+// through its listed-servers guard instead.
+var keymailTestServers []string
+
// authPages are the two pages auth asks the app for (newAuthPlugin).
type authPages struct {
refused func(http.ResponseWriter, *http.Request, rauth.Identity)
diff --git a/internal/calendar/credits/notices.json b/internal/calendar/credits/notices.json
index 18ff0d8..4027f34 100644
--- a/internal/calendar/credits/notices.json
+++ b/internal/calendar/credits/notices.json
@@ -46,7 +46,7 @@
},
{
"Name": "amadan.net/rastrillo/rastrillo",
- "Version": "v0.44.1",
+ "Version": "v0.45.0",
"SourceURL": "https://amadan.net/rastrillo/rastrillo",
"Notices": [
{
diff --git a/internal/calendar/keymail_signin_test.go b/internal/calendar/keymail_signin_test.go
index 256df17..0ba594a 100644
--- a/internal/calendar/keymail_signin_test.go
+++ b/internal/calendar/keymail_signin_test.go
@@ -29,6 +29,7 @@ import (
// query is answered NXDOMAIN and only the Keymail fixtures a test
// registers answer HTTPS (keymailtest).
func TestMain(m *testing.M) {
+ SetKeymailServersForTest([]string{keymailHost})
restore, err := keymailtest.Install()
if err != nil {
fmt.Fprintln(os.Stderr, "keymailtest.Install:", err)
diff --git a/internal/calendar/signin_browser_test.go b/internal/calendar/signin_browser_test.go
index 81d6f8e..ef34f68 100644
--- a/internal/calendar/signin_browser_test.go
+++ b/internal/calendar/signin_browser_test.go
@@ -173,7 +173,7 @@ func TestSmartDoorInABrowser(t *testing.T) {
{name: "step-up", path: "/signin?reauth=1", heading: "Sign in to Calendar"},
{name: "sent", path: "/signin?sent=1", heading: "Check your email"},
{name: "confirm", path: confirm, heading: "Sign in to Calendar"},
- {name: "continuation", path: continuePreviewPath, heading: "Taking you to Keymail"},
+ {name: "continuation", path: continuePreviewPath, heading: "Signing you in"}, // rastrillo v0.45.0 never names Keymail
{name: "signed out", path: "/signed-out", heading: "You’re signed out"},
} {
for _, width := range []int64{320, 1280} {
diff --git a/internal/calendar/signin_door_states_test.go b/internal/calendar/signin_door_states_test.go
index ac4e2e3..630786e 100644
--- a/internal/calendar/signin_door_states_test.go
+++ b/internal/calendar/signin_door_states_test.go
@@ -70,7 +70,8 @@ func TestSmartDoorStatesWithHome(t *testing.T) {
not: []string{">Email</span>"}},
{name: "Keymail remembered", path: "/signin",
record: &lastsignin.Record{Method: lastsignin.MethodKeymail, Address: "bob@example.test"},
- want: []string{"Continue to Keymail", `name="expect" value="keymail"`, "as <bdi>bob@example.test</bdi>", otherWays}},
+ // rastrillo v0.45.0: the door never names Keymail.
+ want: []string{"Continue as <bdi>bob@example.test</bdi>", `name="expect" value="keymail"`, otherWays}},
{name: "problem", path: "/signin?err=expired", record: oficina,
want: []string{"That link has expired or was already used.", emailField},
not: []string{oficinaButton},
@@ -78,7 +79,7 @@ func TestSmartDoorStatesWithHome(t *testing.T) {
{name: "rate", path: "/signin?err=rate",
want: []string{"Too many tries. Try again in a few minutes.", emailField}},
{name: "a failed Keymail keeps force", path: "/signin?err=keymail&force=1",
- want: []string{"Keymail couldn't confirm it's you.", `name="force" value="1"`, "Send me a link instead"}},
+ want: []string{"We couldn't confirm it's you.", `name="force" value="1"`, "Send me a link instead"}},
{name: "removed is team mode's alone", path: "/signin?err=removed",
want: []string{"Something went wrong. Try again."},
not: []string{appProblem, signinRemoved}},
diff --git a/internal/calendar/static/calendar.css b/internal/calendar/static/calendar.css
index 7b4b263..862f164 100644
--- a/internal/calendar/static/calendar.css
+++ b/internal/calendar/static/calendar.css
@@ -112,7 +112,7 @@ html { scroll-padding-block-start: var(--estilo-bar-block-size); }
[cal-day-cell] {
display: flex;
flex-direction: column;
- gap: 2px; /* spacing-allow: the month grid's chips, stacked tight so a 7.5rem day holds four */
+ gap: 2px; /* spacing-allow: the month grid's chips, stacked tight so a 7.5rem day holds three and its "+N more" */
height: 100%;
padding: var(--rst-sp-1);
}
@@ -149,7 +149,7 @@ html { scroll-padding-block-start: var(--estilo-bar-block-size); }
[cal-more] {
color: var(--rst-text-muted);
font-size: var(--rst-fs-xs);
- padding-inline-start: 2px; /* spacing-allow: lines "+N more" up with the chips' text, past their 3px rule */
+ padding-inline-start: 2px; /* spacing-allow: "+N more" sits on the day number's 2px inset, in the month grid's cell */
}
/* ── Chips ─────────────────────────────────────────────────────── */
@@ -168,7 +168,7 @@ html { scroll-padding-block-start: var(--estilo-bar-block-size); }
font-size: var(--rst-fs-sm);
gap: var(--rst-sp-1);
overflow: hidden;
- padding: 2px var(--rst-sp-1); /* spacing-allow: a chip is one line of small text in the month grid's dense cell */
+ padding: 2px var(--rst-sp-1); /* spacing-allow: a chip is one line of small text, the calendar's own unit in the month cell, the agenda and the day and week columns */
text-decoration: none;
white-space: nowrap;
}
@@ -617,8 +617,6 @@ html { scroll-padding-block-start: var(--estilo-bar-block-size); }
padding-inline-start: var(--rst-sp-4);
}
-[cal-book-page] { margin-block-end: var(--rst-sp-4); }
-
[cal-book-page-body] { padding: var(--rst-sp-3); }
[cal-book-url] { font-size: var(--rst-fs-sm); overflow-wrap: anywhere; }
@@ -659,7 +657,6 @@ html { scroll-padding-block-start: var(--estilo-bar-block-size); }
display: flex;
flex-wrap: wrap;
gap: var(--rst-sp-2);
- margin-block: var(--rst-sp-3);
}
[cal-book-details] { padding: var(--rst-sp-3); }
@@ -669,7 +666,6 @@ html { scroll-padding-block-start: var(--estilo-bar-block-size); }
display: flex;
flex-wrap: wrap;
gap: var(--rst-sp-2);
- margin-block: var(--rst-sp-4) var(--rst-sp-2);
}
/* The booker's closing row (rastrillo's form-foot, reached through our
@@ -711,16 +707,12 @@ html { scroll-padding-block-start: var(--estilo-bar-block-size); }
font: inherit;
font-size: var(--rst-fs-sm);
}
-[cal-notices] + [cal-bar] {
- margin-top: var(--rst-sp-3);
-}
[cal-reminder-add] {
display: flex;
align-items: flex-end;
gap: var(--rst-sp-2);
margin-top: var(--rst-sp-3);
}
-[cal-feed-new] { margin-top: var(--rst-sp-4); }
/* A calendar's swatch on the Calendars list: its hue, the one value the
* attribute still carries. */
[cal-dot] {
diff --git a/internal/calendar/templates/book_gone.html b/internal/calendar/templates/book_gone.html
index 5f820bd..929fbd8 100644
--- a/internal/calendar/templates/book_gone.html
+++ b/internal/calendar/templates/book_gone.html
@@ -7,5 +7,5 @@
</header>
<p>{{.Data.Why}}</p>
-{{if .Data.Path}}<p><a rst-btn href="{{.Data.Path}}?zone={{.Data.Zone}}">Book a time</a></p>{{end}}
+{{if .Data.Path}}<div rst-actions><a rst-btn href="{{.Data.Path}}?zone={{.Data.Zone}}">Book a time</a></div>{{end}}
{{end}}
diff --git a/internal/calendar/templates/book_manage.html b/internal/calendar/templates/book_manage.html
index 4b906ab..cececb4 100644
--- a/internal/calendar/templates/book_manage.html
+++ b/internal/calendar/templates/book_manage.html
@@ -16,7 +16,7 @@
{{template "detail-list" dict "Items" $items}}
{{with .Data.HostWhen}}<p cal-elsewhere>That is {{.}} where {{$.Data.HostName}} is.</p>{{end}}
-<div cal-book-manage-actions>
+<div rst-actions cal-book-manage-actions>
<a rst-btn="primary" href="/book/m/{{.Data.Token}}/calendar.ics">Add to calendar</a>
<a rst-btn href="/book/m/{{.Data.Token}}/reschedule">Reschedule</a>
<form method="post" action="/book/m/{{.Data.Token}}/cancel">
diff --git a/internal/calendar/templates/event.html b/internal/calendar/templates/event.html
index 2ae8dc9..9711a2e 100644
--- a/internal/calendar/templates/event.html
+++ b/internal/calendar/templates/event.html
@@ -103,7 +103,7 @@
</div>
</section>
-<div cal-bar>
+<div rst-actions cal-bar>
<a rst-btn="ghost" href="/events/{{.Data.Event.ID}}.ics">Download as .ics</a>
{{if .Data.Event.Writable}}
{{/* The destructive action is a link to its own page, never a
diff --git a/internal/calendar/templates/reminders.html b/internal/calendar/templates/reminders.html
index fd41415..11faf9e 100644
--- a/internal/calendar/templates/reminders.html
+++ b/internal/calendar/templates/reminders.html
@@ -24,7 +24,7 @@
</div>
{{end}}
</div>
-<div cal-bar>
+<div rst-actions cal-bar>
<form method="post" action="/reminders/dismiss">
<button rst-btn type="submit">Dismiss all</button>
</form>
diff --git a/internal/calendar/templates/share.html b/internal/calendar/templates/share.html
index 65d23fd..e02ab20 100644
--- a/internal/calendar/templates/share.html
+++ b/internal/calendar/templates/share.html
@@ -46,7 +46,7 @@
"Body" "A link lets another calendar app read this one. Nothing is shared until you make one."}}
{{end}}
-<form cal-feed-new method="post" action="/calendars/{{.Data.Calendar.ID}}/feeds">
+<form rst-actions cal-feed-new method="post" action="/calendars/{{.Data.Calendar.ID}}/feeds">
<button rst-btn="primary" type="submit">Create a subscription link</button>
</form>
{{end}}
diff --git a/internal/calendar/testing.go b/internal/calendar/testing.go
index f2d2411..ff0b15e 100644
--- a/internal/calendar/testing.go
+++ b/internal/calendar/testing.go
@@ -256,3 +256,11 @@ func (a *App) TrySendNowForTest(bookingID int64) bool {
func (a *App) FlushSigninMailForTest() {
a.signinMail.wait()
}
+
+// SetKeymailServersForTest lists the Keymail servers every App built
+// afterwards in this process may contact (rauth.Config.KeymailServers):
+// a test main's in-process fixtures, behind keymailtest's transport. An
+// empty, non-nil list means none. Never called outside tests.
+func SetKeymailServersForTest(servers []string) {
+ keymailTestServers = servers
+}
diff --git a/internal/calendartest/main_test.go b/internal/calendartest/main_test.go
index 97f7ee6..e344369 100644
--- a/internal/calendartest/main_test.go
+++ b/internal/calendartest/main_test.go
@@ -11,6 +11,7 @@ import (
"testing"
"time"
+ calendar "amadan.net/oficina/calendar/internal/calendar"
"amadan.net/oficina/calendar/internal/calendar/keymailtest"
)
@@ -20,6 +21,8 @@ import (
// query is answered NXDOMAIN; no fixture is registered here, so every
// address is plain email.
func TestMain(m *testing.M) {
+ // No fixture is registered here, so no server is listed either.
+ calendar.SetKeymailServersForTest([]string{})
restore, err := keymailtest.Install()
if err != nil {
fmt.Fprintln(os.Stderr, "keymailtest.Install:", err)
diff --git a/internal/calendartest/rhythm_browser_test.go b/internal/calendartest/rhythm_browser_test.go
index 4143237..d12c0d5 100644
--- a/internal/calendartest/rhythm_browser_test.go
+++ b/internal/calendartest/rhythm_browser_test.go
@@ -4,9 +4,11 @@ package calendartest
import (
"context"
+ "fmt"
"io"
"log/slog"
"net/http"
+ "os"
"path/filepath"
"regexp"
"testing"
@@ -31,6 +33,11 @@ import (
// The audit reads around the calendar grids themselves (the month's
// table, the day's and week's columns of hours), whose cells are
// drawn to the clock and the calendar, not to the page's rhythm.
+//
+// On origin/main's tree, before <main> was Fiesta's stack, it fails:
+// the booking page's zone form rested 14px under its description, and
+// the button rows sat 12px under the text above them. Help → Open
+// source is estilo's credits page, left to estilo.
func TestEveryScreenKeepsTheRhythm(t *testing.T) {
var app *calendar.App
rig := harness.New(t, func(origin string) http.Handler {
@@ -83,28 +90,43 @@ func TestEveryScreenKeepsTheRhythm(t *testing.T) {
t.Fatalf("%s: %v", what, err)
}
}
- // Each screen is loaded once, at a desktop width, and read there and
- // again at a phone's.
+ // Each screen is read at a desktop width and again at a phone's.
+ // With a path, it is loaded first, once, and must still be at that
+ // path when read: a lost session lands on the sign-in door, whose
+ // rhythm is not this page's. Without one, the page the last step
+ // landed on is read. ready is a selector only that screen draws,
+ // and main must hold at least blocks elements, so a page that drew
+ // nothing cannot pass by having nothing to measure.
grids := []string{"[cal-month]", "[cal-grid]", "[cal-week-scroll]"}
- audit := func(name, path, ready string) {
+ audit := func(name, path, ready string, blocks int) {
t.Helper()
for i, width := range []int64{1280, 390} {
var found []rhythm.Finding
+ var at string
+ var drawn int
actions := []chromedp.Action[chromedp.Void]{deviceMetrics(width, 900)}
- if i == 0 {
+ if i == 0 && path != "" {
actions = append(actions, chromedp.Navigate(rig.Origin+path))
}
actions = append(actions,
chromedp.WaitVisible(chromedp.CSS(ready)),
+ evalInto(&at, `location.pathname + location.search`),
+ evalInto(&drawn, `document.querySelectorAll('main *').length`),
evalInto(&found, rhythm.Expression("main", rhythm.Options{Skip: grids})))
run(name, actions...)
+ if path != "" && at != path {
+ t.Fatalf("%s: the browser is at %s, not %s", name, at, path)
+ }
+ if drawn < blocks {
+ t.Fatalf("%s at %dpx: main holds %d elements, want at least %d", name, width, drawn, blocks)
+ }
if len(found) > 0 {
t.Errorf("%s at %dpx: %s", name, width, rhythm.Report(found))
}
}
}
- audit("the sign-in door", "/signin", `input[name="address"]`)
+ audit("the sign-in door", "/signin", `input[name="address"]`, 3)
run("sign in", setCookie(rig.Origin, session))
@@ -121,20 +143,87 @@ func TestEveryScreenKeepsTheRhythm(t *testing.T) {
if event == "" {
t.Fatalf("creating an event landed on %s", at)
}
+ // A repeating one, whose page and delete offer the series.
+ personal, err := st.DefaultCalendarID(ctx, host.ID)
+ if err != nil {
+ t.Fatal(err)
+ }
+ weekly, err := st.CreateEvent(ctx, host.ID, calendar.EventInput{CalendarID: personal, Title: "Weekly review",
+ StartLocal: "2026-09-03T15:00", EndLocal: "2026-09-03T16:00", TZ: "UTC", RRule: "FREQ=WEEKLY"})
+ if err != nil {
+ t.Fatal(err)
+ }
+ series := fmt.Sprintf("/events/%d", weekly.ID)
for _, view := range []string{"/day/2026-09-02", "/week/2026-09-02", "/month/2026-09", "/agenda?from=2026-09-02"} {
- audit(view, view, `main`)
+ audit(view, view, `main [cal-view-tabs], main nav, main h1`, 6)
+ }
+ audit("a new event", "/events/new", `input[name="title"]`, 8)
+ audit("editing an event", event+"/edit", `input[name="title"]`, 8)
+ audit("an event", event, `form[action$="/reminders"]`, 8)
+ audit("deleting an event", event+"/delete", `main form[action$="/delete"]`, 4)
+ audit("a repeating event", series, `form[action$="/reminders"]`, 8)
+ audit("deleting a repeating event", series+"/delete", `main form[action$="/delete"]`, 4)
+ audit("settings", "/settings", `main form`, 8)
+ audit("reminders", "/reminders", `main h1`, 3)
+ audit("calendars", "/calendars", `main [cal-dot]`, 4)
+ audit("sharing a calendar", "/calendars/1/share", `form[cal-feed-new]`, 4)
+ run("make a subscription link",
+ chromedp.Navigate(rig.Origin+"/calendars/1/share"),
+ chromedp.WaitVisible(chromedp.CSS(`form[cal-feed-new] button`)),
+ chromedp.Click(chromedp.CSS(`form[cal-feed-new] button`)),
+ chromedp.WaitVisible(chromedp.CSS(`main [rst-list], main ul`)))
+ audit("sharing a calendar, with a link", "", `form[cal-feed-new]`, 6)
+ audit("import", "/import", `main form input[type=file]`, 6)
+ ics := filepath.Join(t.TempDir(), "one.ics")
+ if err := os.WriteFile(ics, []byte("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//test//EN\r\nBEGIN:VEVENT\r\nUID:one@test\r\nDTSTAMP:20260901T000000Z\r\nDTSTART:20260904T100000Z\r\nDTEND:20260904T110000Z\r\nSUMMARY:Imported\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"), 0o600); err != nil {
+ t.Fatal(err)
+ }
+ run("import a file",
+ chromedp.Navigate(rig.Origin+"/import"),
+ chromedp.WaitVisible(chromedp.CSS(`input[type=file]`)),
+ chromedp.SetUploadFiles(`input[type=file]`, []string{ics}),
+ chromedp.Click(chromedp.CSS(`form[action="/import"] button[type=submit]`)),
+ chromedp.WaitNotPresent(chromedp.CSS(`form[action="/import"] input[type=file]`)))
+ audit("import done", "", `main h1`, 3)
+ audit("booking pages", "/settings/booking", `main [cal-book-page]`, 6)
+ audit("a new booking page", "/settings/booking/new", `main form`, 8)
+ audit("a page that is not there", "/events/999999", `main`, 1)
+
+ // The stranger's side: the page, a day's slots, a slot's details,
+ // the hold, then the mailed link: confirm, manage, reschedule,
+ // cancel.
+ public := "/book/paul/" + page.Code + "?zone=UTC"
+ audit("the booking page", public, `[cal-book-days] a`, 6)
+ var day string
+ run("a booking day", evalInto(&day, `document.querySelector('[cal-book-days] a').getAttribute('href')`))
+ audit("a booking day", day, `[cal-book-slot]`, 6)
+ run("a slot", chromedp.Click(chromedp.CSS(`[cal-book-slot]`)), chromedp.WaitVisible(chromedp.CSS(`[cal-book-details] input[name="name"]`)))
+ audit("a slot's details", "", `[cal-book-details]`, 8)
+ run("hold it",
+ chromedp.SendKeys(chromedp.CSS(`#name`), "Doc"),
+ chromedp.SendKeys(chromedp.CSS(`#address`), "doc@example.com"),
+ chromedp.Click(chromedp.CSS(`[cal-book-details] button[type=submit]`)),
+ chromedp.WaitNotPresent(chromedp.CSS(`[cal-book-details]`)))
+ audit("the hold, sent", "", `main h1`, 3)
+ mail, err := app.LastMailForTest()
+ if err != nil {
+ t.Fatal(err)
+ }
+ manage := regexp.MustCompile(`/book/m/[0-9a-f]{64}`).FindString(mail)
+ if manage == "" {
+ t.Fatalf("no manage link in the hold mail")
}
- audit("a new event", "/events/new", `input[name="title"]`)
- audit("editing an event", event+"/edit", `input[name="title"]`)
- audit("an event", event, `form[action$="/reminders"]`)
- audit("deleting an event", event+"/delete", `main form`)
- audit("settings", "/settings", `main form`)
- audit("reminders", "/reminders", `main`)
- audit("calendars", "/calendars", `main`)
- audit("sharing a calendar", "/calendars/1/share", `main`)
- audit("import", "/import", `main form`)
- audit("booking pages", "/settings/booking", `main`)
- audit("a new booking page", "/settings/booking/new", `main form`)
- audit("the booking page", "/book/paul/"+page.Code+"?zone=UTC", `select[name="zone"]`)
+ audit("the hold, to confirm", manage, `form[action$="/confirm"]`, 4)
+ run("confirm it",
+ chromedp.Click(chromedp.CSS(`form[action$="/confirm"] button`)),
+ chromedp.WaitVisible(chromedp.CSS(`[cal-book-manage-actions]`)))
+ audit("a booking", "", `[cal-book-manage-actions]`, 6)
+ audit("rescheduling a booking", manage+"/reschedule", `main h1`, 4)
+ run("cancel it",
+ chromedp.Navigate(rig.Origin+manage),
+ chromedp.WaitVisible(chromedp.CSS(`form[action$="/cancel"] button`)),
+ chromedp.Click(chromedp.CSS(`form[action$="/cancel"] button`)),
+ chromedp.WaitNotPresent(chromedp.CSS(`form[action$="/cancel"]`)))
+ audit("a cancelled booking", "", `main h1`, 3)
}