package mapatest import ( "net/url" "strings" "testing" ) // The scriptless floor (level-up ยง6.10): every page the editor mounts // on also offers Edit as Markdown, in View and in the kicker, and that // opens today's textarea with Save. An unwritten day and New scratch // page draw the empty page; their textarea is one link away. func TestEveryEditorPageOffersEditAsMarkdown(t *testing.T) { rig := newRig(t) acme := rig.createPage(t, Ana, "Acme", "Customer.") rig.post(t, Ana, "/d/2026-11-12", url.Values{"body": {"Day."}}) for path, markdown := range map[string]string{ acme: acme + "/edit", "/d/2026-11-12": "/d/2026-11-12/edit", "/d/2026-11-13": "/d/2026-11-13/edit", "/scratch/new": "/scratch/new?markdown=1", } { page := rig.page(t, Ana, path) link := `href="` + strings.ReplaceAll(markdown, "&", "&") + `"` if strings.Count(page, link) < 2 || !strings.Contains(page, "Edit as Markdown") { t.Errorf("%s: no Edit as Markdown (%s) in View and the kicker", path, markdown) } if strings.Contains(page, "