aboutsummaryrefslogtreecommitdiffstats
path: root/internal/web/web_test.go
diff options
context:
space:
mode:
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