aboutsummaryrefslogtreecommitdiffstats
path: root/internal/web/web_test.go
diff options
context:
space:
mode:
authorgrm <grm@eyesin.space>2026-09-18 19:18:30 +0300
committergrm <grm@eyesin.space>2026-09-18 19:18:30 +0300
commit0a248d9a0e6ef6439fca25aa854968b6b5dac2ef (patch)
tree54c770cfb8dd8c26d0fa128f584be6a8211d7181 /internal/web/web_test.go
parentb88a7d22c8d79b30de3403c631dd2c5f67669537 (diff)
downloadblogspace-0a248d9a0e6ef6439fca25aa854968b6b5dac2ef.tar.gz
blogspace-0a248d9a0e6ef6439fca25aa854968b6b5dac2ef.tar.bz2
blogspace-0a248d9a0e6ef6439fca25aa854968b6b5dac2ef.zip
Add menu link size, spacing, a current-page mark and a spread alignment
Size and spacing selects, a choice of how the current page's link is marked (underlined as before, bold, boxed or not at all) and a fourth alignment that spreads the header's links across the bar. Alignment joins the other menu classes on the body, so the theme CSS no longer sets it; spread is justified text with a full-width last line, which old browsers lay out too, and stays out of the column menus. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sd8UPWrvyYCLj97JexNw3A
Diffstat (limited to 'internal/web/web_test.go')
-rw-r--r--internal/web/web_test.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/internal/web/web_test.go b/internal/web/web_test.go
index e12f9e0..45bdf22 100644
--- a/internal/web/web_test.go
+++ b/internal/web/web_test.go
@@ -107,12 +107,12 @@ func TestThemeNormalizeAndCSS(t *testing.T) {
if th.BgColor != "#abcdef" || th.BgImage != "" || th.LogoSize != "large" || th.RuleClass() != "ruled rule-stripes" {
t.Errorf("from form: %+v", th)
}
- if th.LinkHover != "" || th.NavHover != "#00ff00" || th.ShowDates || th.DateFormat != "iso" || th.NavBold || !th.NavUpper {
+ if th.LinkHover != "" || th.NavHover != "#00ff00" || th.ShowDates || th.DateFormat != "iso" || th.NavBold || !th.NavUpper || th.NavAlign != "center" {
t.Errorf("hover checkbox / unticked checkboxes: %+v", th)
}
css := th.CSS()
for _, want := range []string{"background-color:#abcdef", ".site-nav a:hover { color:#00ff00", "a:hover { text-decoration:underline",
- "h1, h2, h3, h4, h5, h6 { font-family:Georgia", "text-align:center", "border-radius:0", "padding:2.2em 3em", "@media (max-width: 700px)", ".logo { max-height:140px"} {
+ "h1, h2, h3, h4, h5, h6 { font-family:Georgia", "border-radius:0", "padding:2.2em 3em", "@media (max-width: 700px)", ".logo { max-height:140px"} {
if !strings.Contains(css, want) {
t.Errorf("css missing %q:\n%s", want, css)
}
@@ -143,16 +143,16 @@ func TestThemeNormalizeAndCSS(t *testing.T) {
// from stored themes (bold + hover underline is what blog.css always drew).
func TestNavStyles(t *testing.T) {
th := ParseTheme([]byte(`{"nav_style":"uppercase"}`))
- if !th.NavUpper || !th.NavBold || th.NavUnderline != "hover" || th.NavStyle != "" || strings.Contains(string(th.JSON()), "nav_style") {
+ if !th.NavUpper || th.NavSize != "small" || !th.NavBold || th.NavUnderline != "hover" || th.NavStyle != "" || strings.Contains(string(th.JSON()), "nav_style") {
t.Errorf("uppercase migration: %+v %s", th, th.JSON())
}
th = ParseTheme([]byte(`{"nav_style":"plain"}`))
if th.NavBold || th.NavUpper || th.NavUnderline != "always" {
t.Errorf("plain migration: %+v", th)
}
- for _, raw := range []string{`{}`, `{"nav_style":"normal"}`, `{"nav_underline":"wavy"}`} {
+ for _, raw := range []string{`{}`, `{"nav_style":"normal"}`, `{"nav_underline":"wavy","nav_size":"huge","nav_gap":"x","nav_active":"blink","nav_align":"justify"}`} {
th = ParseTheme([]byte(raw))
- if !th.NavBold || th.NavUpper || th.NavUnderline != "hover" || th.NavClass() != "nav-ul-hover nav-bold" {
+ if !th.NavBold || th.NavUpper || th.NavUnderline != "hover" || th.NavClass() != "nav-left nav-ul-hover nav-size-normal nav-gap-normal nav-active-underline nav-bold" {
t.Errorf("%s: %+v %q", raw, th, th.NavClass())
}
}
@@ -160,10 +160,14 @@ func TestNavStyles(t *testing.T) {
if th = ParseTheme([]byte(`{"nav_bold":false,"nav_upper":true,"nav_underline":"never"}`)); th.NavBold || !th.NavUpper || th.NavUnderline != "never" {
t.Errorf("stored switches: %+v", th)
}
- th = ThemeFromForm(DefaultTheme(), url.Values{"nav_underline": {"always"}})
- if th.NavBold || th.NavUpper || th.NavClass() != "nav-ul-always" {
+ th = ThemeFromForm(DefaultTheme(), url.Values{"nav_underline": {"always"}, "nav_align": {"spread"}, "nav_size": {"large"}, "nav_gap": {"wide"}, "nav_active": {"box"}})
+ if th.NavBold || th.NavUpper || th.NavClass() != "nav-spread nav-ul-always nav-size-large nav-gap-wide nav-active-box" {
t.Errorf("from form: %+v %q", th, th.NavClass())
}
+ // Alignment is a class now; the theme CSS says nothing about it.
+ if css := th.CSS(); strings.Contains(css, "nav-inner") {
+ t.Errorf("nav align in css: %s", css)
+ }
}
// Announcements on post pages are on by default (the look blogs had before