oficina / estilo Public

chrome: record today's bar markup as goldens before the slots

A bar with neither Menubar nor Lead must stay byte for byte what main
renders at f6d5605; these goldens are that record.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev f9b005d491dcf8e9cd158ea53e16289b19345c66 parent f6d5605
6 files changed, +186 −0
  • chrome/testdata/unchanged-dialog.html +37 −0
  • chrome/testdata/unchanged-public.html +6 −0
  • chrome/testdata/unchanged-signed-in.html +37 −0
  • chrome/testdata/unchanged-signed-out.html +6 −0
  • chrome/testdata/unchanged-sticky.html +37 −0
  • chrome/unchanged_test.go +63 −0

CI cancelled — superseded by a newer push — run details

diff --git a/chrome/testdata/unchanged-dialog.html b/chrome/testdata/unchanged-dialog.html
new file mode 100644
index 0000000..732c4cf
--- /dev/null
+++ b/chrome/testdata/unchanged-dialog.html
@@ -0,0 +1,37 @@
+<header estilo-bar>
+ <a estilo-bar-brand href="/"><img estilo-brand-icon src="/static/estilo/brand/docs.svg" alt="" width="28" height="28"><span estilo-bar-name>x-app</span></a>
+ <form estilo-bar-title method="post" action="/d/abc/title">
+ <input estilo-bar-title-input name="title" value="x-title" aria-label="x-title-label" autocomplete="off" spellcheck="false" dir="auto">
+ <button rst-btn="ghost" type="submit" estilo-bar-title-submit>x-rename</button>
+ </form>
+ <nav estilo-bar-nav aria-label="x-navlabel"><a href="/" aria-current="page">x-nav</a>
+ </nav>
+ <div estilo-bar-end>
+ <div estilo-bar-actions><button rst-btn type="button" commandfor="help" command="show-modal">x-help</button><a rst-btn="primary" href="/n">x-new</a></div>
+ <details estilo-bar-more name="estilo-menus">
+ <summary estilo-bar-trigger><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 12h16M4 6h16M4 18h16"/></svg><span>x-menu</span></summary>
+ <div estilo-menu="sheet"><a estilo-menu-item href="/" aria-current="page"><span estilo-menu-label>x-nav</span></a><hr><button estilo-menu-item type="button" commandfor="help" command="show-modal"><span estilo-menu-label>x-help</span></button><a estilo-menu-item href="/n"><span estilo-menu-label>x-new</span></a>
+ </div>
+ </details>
+ <details estilo-switcher name="estilo-menus">
+ <summary estilo-bar-trigger aria-label="x-apps"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect width="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/></svg></summary>
+ <div estilo-menu estilo-switcher-panel>
+ <a estilo-menu-item href="https://oficina.example/"><span estilo-menu-label>x-allapps</span></a>
+ </div>
+ </details>
+ <details estilo-account name="estilo-menus">
+ <summary estilo-bar-trigger aria-label="x-trigger"><span estilo-avatar aria-hidden="true">P</span></summary>
+ <div estilo-menu estilo-account-panel>
+ <div estilo-menu-identity>
+ <span estilo-menu-identity-label>x-signedinas</span><span estilo-menu-identity-address dir="auto">paul@example.test</span>
+ </div><hr><a estilo-menu-item href="/account/home"><span estilo-menu-label>x-connect</span></a>
+ <hr>
+ <p estilo-menu-heading>x-help</p><a estilo-menu-item href="/credits"><span estilo-menu-label>x-opensource</span></a>
+ <hr>
+ <form method="post" action="/signout">
+ <button estilo-menu-item type="submit"><span estilo-menu-label>x-signout</span></button>
+ </form>
+ </div>
+ </details>
+ </div>
+</header>
\ No newline at end of file
diff --git a/chrome/testdata/unchanged-public.html b/chrome/testdata/unchanged-public.html
new file mode 100644
index 0000000..2a32e05
--- /dev/null
+++ b/chrome/testdata/unchanged-public.html
@@ -0,0 +1,6 @@
+<header estilo-bar>
+ <span estilo-bar-brand><img estilo-brand-icon src="/i.svg" alt="" width="28" height="28"><span estilo-bar-name>Docs</span></span>
+ <span estilo-bar-context dir="auto" title="A document">A document</span>
+ <div estilo-bar-end>
+ </div>
+</header>
\ No newline at end of file
diff --git a/chrome/testdata/unchanged-signed-in.html b/chrome/testdata/unchanged-signed-in.html
new file mode 100644
index 0000000..9176c39
--- /dev/null
+++ b/chrome/testdata/unchanged-signed-in.html
@@ -0,0 +1,37 @@
+<header estilo-bar>
+ <a estilo-bar-brand href="/"><img estilo-brand-icon src="/static/estilo/brand/docs.svg" alt="" width="28" height="28"><span estilo-bar-name>x-app</span></a>
+ <form estilo-bar-title method="post" action="/d/abc/title">
+ <input estilo-bar-title-input name="title" value="x-title" aria-label="x-title-label" autocomplete="off" spellcheck="false" dir="auto">
+ <button rst-btn="ghost" type="submit" estilo-bar-title-submit>x-rename</button>
+ </form>
+ <nav estilo-bar-nav aria-label="x-navlabel"><a href="/" aria-current="page">x-nav</a>
+ </nav>
+ <div estilo-bar-end>
+ <div estilo-bar-actions><a rst-btn href="/d/abc/share">x-share</a><form method="post" action="/d/new"><button rst-btn="primary" type="submit">x-create</button></form></div>
+ <details estilo-bar-more name="estilo-menus">
+ <summary estilo-bar-trigger><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 12h16M4 6h16M4 18h16"/></svg><span>x-menu</span></summary>
+ <div estilo-menu="sheet"><a estilo-menu-item href="/" aria-current="page"><span estilo-menu-label>x-nav</span></a><hr><a estilo-menu-item href="/d/abc/share"><span estilo-menu-label>x-share</span></a><form method="post" action="/d/new"><button estilo-menu-item type="submit"><span estilo-menu-label>x-create</span></button></form>
+ </div>
+ </details>
+ <details estilo-switcher name="estilo-menus">
+ <summary estilo-bar-trigger aria-label="x-apps"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect width="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/></svg></summary>
+ <div estilo-menu estilo-switcher-panel>
+ <a estilo-menu-item href="https://oficina.example/"><span estilo-menu-label>x-allapps</span></a>
+ </div>
+ </details>
+ <details estilo-account name="estilo-menus">
+ <summary estilo-bar-trigger aria-label="x-trigger"><span estilo-avatar aria-hidden="true">P</span></summary>
+ <div estilo-menu estilo-account-panel>
+ <div estilo-menu-identity>
+ <span estilo-menu-identity-label>x-signedinas</span><span estilo-menu-identity-address dir="auto">paul@example.test</span>
+ </div><hr><a estilo-menu-item href="/account/home"><span estilo-menu-label>x-connect</span></a>
+ <hr>
+ <p estilo-menu-heading>x-help</p><a estilo-menu-item href="/credits"><span estilo-menu-label>x-opensource</span></a>
+ <hr>
+ <form method="post" action="/signout">
+ <button estilo-menu-item type="submit"><span estilo-menu-label>x-signout</span></button>
+ </form>
+ </div>
+ </details>
+ </div>
+</header>
\ No newline at end of file
diff --git a/chrome/testdata/unchanged-signed-out.html b/chrome/testdata/unchanged-signed-out.html
new file mode 100644
index 0000000..8cd9cce
--- /dev/null
+++ b/chrome/testdata/unchanged-signed-out.html
@@ -0,0 +1,6 @@
+<header estilo-bar>
+ <a estilo-bar-brand href="/"><img estilo-brand-icon src="/i.svg" alt="" width="28" height="28"><span estilo-bar-name>Docs</span></a>
+ <div estilo-bar-end>
+ <a rst-btn href="/signin?return_to=%2Fd%2Fabc" estilo-bar-signin>Sign in</a>
+ </div>
+</header>
\ No newline at end of file
diff --git a/chrome/testdata/unchanged-sticky.html b/chrome/testdata/unchanged-sticky.html
new file mode 100644
index 0000000..2b69c2f
--- /dev/null
+++ b/chrome/testdata/unchanged-sticky.html
@@ -0,0 +1,37 @@
+<header estilo-bar="sticky">
+ <a estilo-bar-brand href="/"><img estilo-brand-icon src="/static/estilo/brand/docs.svg" alt="" width="28" height="28"><span estilo-bar-name>x-app</span></a>
+ <form estilo-bar-title method="post" action="/d/abc/title">
+ <input estilo-bar-title-input name="title" value="x-title" aria-label="x-title-label" autocomplete="off" spellcheck="false" dir="auto">
+ <button rst-btn="ghost" type="submit" estilo-bar-title-submit>x-rename</button>
+ </form>
+ <nav estilo-bar-nav aria-label="x-navlabel"><a href="/" aria-current="page">x-nav</a>
+ </nav>
+ <div estilo-bar-end>
+ <div estilo-bar-actions><a rst-btn href="/d/abc/share">x-share</a><form method="post" action="/d/new"><button rst-btn="primary" type="submit">x-create</button></form></div>
+ <details estilo-bar-more name="estilo-menus">
+ <summary estilo-bar-trigger><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 12h16M4 6h16M4 18h16"/></svg><span>x-menu</span></summary>
+ <div estilo-menu="sheet"><a estilo-menu-item href="/" aria-current="page"><span estilo-menu-label>x-nav</span></a><hr><a estilo-menu-item href="/d/abc/share"><span estilo-menu-label>x-share</span></a><form method="post" action="/d/new"><button estilo-menu-item type="submit"><span estilo-menu-label>x-create</span></button></form>
+ </div>
+ </details>
+ <details estilo-switcher name="estilo-menus">
+ <summary estilo-bar-trigger aria-label="x-apps"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect width="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/></svg></summary>
+ <div estilo-menu estilo-switcher-panel>
+ <a estilo-menu-item href="https://oficina.example/"><span estilo-menu-label>x-allapps</span></a>
+ </div>
+ </details>
+ <details estilo-account name="estilo-menus">
+ <summary estilo-bar-trigger aria-label="x-trigger"><span estilo-avatar aria-hidden="true">P</span></summary>
+ <div estilo-menu estilo-account-panel>
+ <div estilo-menu-identity>
+ <span estilo-menu-identity-label>x-signedinas</span><span estilo-menu-identity-address dir="auto">paul@example.test</span>
+ </div><hr><a estilo-menu-item href="/account/home"><span estilo-menu-label>x-connect</span></a>
+ <hr>
+ <p estilo-menu-heading>x-help</p><a estilo-menu-item href="/credits"><span estilo-menu-label>x-opensource</span></a>
+ <hr>
+ <form method="post" action="/signout">
+ <button estilo-menu-item type="submit"><span estilo-menu-label>x-signout</span></button>
+ </form>
+ </div>
+ </details>
+ </div>
+</header>
\ No newline at end of file
diff --git a/chrome/unchanged_test.go b/chrome/unchanged_test.go
new file mode 100644
index 0000000..7e11172
--- /dev/null
+++ b/chrome/unchanged_test.go
@@ -0,0 +1,63 @@
+package chrome
+
+import (
+ "flag"
+ "os"
+ "path/filepath"
+ "testing"
+
+ "amadan.net/oficina/estilo.git/menu"
+)
+
+var update = flag.Bool("update", false, "rewrite testdata/unchanged-*.html from the current templates")
+
+// unchangedBars are bars with neither Menubar nor Lead set. Their markup
+// was recorded from main at f6d5605, before the slots existed
+// (testdata/unchanged-*.html), and must stay byte for byte what it was:
+// the slots are opt-in, so an app that sets neither sees nothing move.
+//
+// The account's Appearance group is left out on purpose. It changed for
+// every app on bar-stack (the segmented selector, switched in place), and
+// TestAppearanceIsASegmentedSelectorSwitchedInPlace holds that.
+func unchangedBars() map[string]any {
+ full := signedIn("x")
+ full.Account.Appearance = nil
+ sticky := signedIn("x")
+ sticky.Account.Appearance = nil
+ sticky.Sticky = true
+ dialog := signedIn("x")
+ dialog.Account.Appearance = nil
+ dialog.Actions = []Action{{Item: menu.Item{Dialog: "help", Label: "x-help"}}, {Item: menu.Item{Href: "/n", Label: "x-new"}, Primary: true}}
+ return map[string]any{
+ "signed-in": full,
+ "sticky": sticky,
+ "dialog": dialog,
+ "public": Bar{App: App{Name: "Docs", Icon: "/i.svg"}, Context: "A document"},
+ "signed-out": Bar{App: App{Name: "Docs", Home: "/", Icon: "/i.svg"}, SignIn: &Link{Href: "/signin?return_to=%2Fd%2Fabc", Label: "Sign in"}},
+ }
+}
+
+func TestABarWithoutSlotsIsByteForByteUnchanged(t *testing.T) {
+ for name, bar := range unchangedBars() {
+ t.Run(name, func(t *testing.T) {
+ got := render(t, "estilo-bar", bar)
+ path := filepath.Join("testdata", "unchanged-"+name+".html")
+ if *update {
+ if err := os.MkdirAll("testdata", 0o755); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(path, []byte(got), 0o644); err != nil {
+ t.Fatal(err)
+ }
+ return
+ }
+ want, err := os.ReadFile(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if got != string(want) {
+ t.Errorf("a bar with no slots changed its markup.\ngot:\n%s\nwant:\n%s", got, want)
+ }
+ })
+ }
+}