From c42c56108ebac6673ec5c86f9f0d51f31e8eb2bd Mon Sep 17 00:00:00 2001 From: grm Date: Sat, 19 Sep 2026 00:04:08 +0300 Subject: Remove the menu fold MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The header menu no longer folds into a ☰ button: the nav_fold and nav_fold_label options, Layout.Fold/BurgerAt, the burger markup and its checkbox, the fold rules in blog.css and the measuring script on the public page are gone, and the Design tab's preview only sizes its frame again. The public page runs no script of its own once more. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Sd8UPWrvyYCLj97JexNw3A --- internal/web/web_test.go | 76 +----------------------------------------------- 1 file changed, 1 insertion(+), 75 deletions(-) (limited to 'internal/web/web_test.go') diff --git a/internal/web/web_test.go b/internal/web/web_test.go index e9e38fb..fc255b1 100644 --- a/internal/web/web_test.go +++ b/internal/web/web_test.go @@ -126,7 +126,7 @@ func TestThemeNormalizeAndCSS(t *testing.T) { } // The menu links' weight, case and underline are body classes blog.css draws; the theme CSS only colours them. css = DefaultTheme().CSS() - if !strings.Contains(css, ".site-nav a, .site-nav .nav-burger { color:#222222; }") || strings.Contains(css, "font-weight") || strings.Contains(css, "text-transform") { + if !strings.Contains(css, ".site-nav a { color:#222222; }") || strings.Contains(css, "font-weight") || strings.Contains(css, "text-transform") { t.Errorf("nav css: %s", css) } if css := DefaultTheme().CSS(); strings.Contains(css, "@font-face") || strings.Contains(css, "h1, h2") { @@ -170,80 +170,6 @@ func TestNavStyles(t *testing.T) { } } -// The header menu folds into a button (theme nav_fold) carried by the title -// or logo block just above it, else by the menu bar; the checkbox that is the -// open/closed state comes first in the header so the CSS can reach both. -func TestHeaderFold(t *testing.T) { - hdr := func(kinds ...string) []store.Module { - var mods []store.Module - for _, k := range kinds { - mods = append(mods, store.Module{Area: "header", Kind: k}) - } - return mods - } - th := DefaultTheme() - if l := buildLayout(th, hdr("title", "menu")); l.Fold { - t.Errorf("fold is off by default: %+v", l) - } - th.NavFold = true - for _, c := range []struct { - kinds []string - logo bool - at int // -1: no fold - }{ - {[]string{"title", "menu"}, false, 0}, {[]string{"menu", "title"}, false, 0}, {[]string{"logo", "menu"}, false, 1}, {[]string{"logo", "menu"}, true, 0}, - {[]string{"search", "menu"}, false, 1}, {[]string{"title", "search", "menu"}, false, 2}, {[]string{"title"}, false, -1}, {nil, false, -1}, - } { - th.Logo = "" - if c.logo { - th.Logo = uuid.New().String() - } - l := buildLayout(th, hdr(c.kinds...)) - if l.Fold != (c.at >= 0) || (l.Fold && l.BurgerAt != c.at) { - t.Errorf("%v (logo %v): fold %v at %d, want %d", c.kinds, c.logo, l.Fold, l.BurgerAt, c.at) - } - } - th.HeaderOn = false - if l := buildLayout(th, hdr("title", "menu")); l.Fold { - t.Errorf("no header, nothing to fold: %+v", l) - } - th.HeaderOn = true - - tpl, err := newTemplates(false).get("en", "blog/page.html") - if err != nil { - t.Fatal(err) - } - render := func(th Theme, mods []store.Module) string { - var b strings.Builder - l := buildLayout(th, mods) - v := view{Blog: &store.Blog{Title: "Gizmo"}, Media: "/media", Data: map[string]any{"theme": th, "layout": l, "menu": []store.MenuItem{{Label: "Home", URL: "/"}, {Label: "About", URL: "/about"}}}} - if err := tpl.ExecuteTemplate(&b, "siteheader", v); err != nil { - t.Fatal(err) - } - return b.String() - } - burger := `` - off := DefaultTheme() - out := render(off, hdr("title", "menu")) - if strings.Contains(out, "nav-toggle") || strings.Contains(out, "nav-burger") || strings.Contains(out, "nav-fold") || strings.Contains(out, "