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.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/web/web_test.go b/internal/web/web_test.go
index a7c189f..34ec057 100644
--- a/internal/web/web_test.go
+++ b/internal/web/web_test.go
@@ -138,6 +138,22 @@ func TestThemeNormalizeAndCSS(t *testing.T) {
}
}
+// Announcements on post pages are on by default (the look blogs had before
+// the switch) and, like every checkbox, off when the box is unticked; stored
+// themes from before the option get the default too.
+func TestPostNotices(t *testing.T) {
+ if !DefaultTheme().PostNotices || !ParseTheme([]byte(`{"show_dates":false}`)).PostNotices {
+ t.Error("post notices should default to on")
+ }
+ th := ThemeFromForm(DefaultTheme(), url.Values{"post_notices": {"on"}})
+ if !th.PostNotices {
+ t.Errorf("ticked: %+v", th)
+ }
+ if th = ThemeFromForm(th, url.Values{"show_dates": {"on"}}); th.PostNotices {
+ t.Errorf("unticked: %+v", th)
+ }
+}
+
// The rule under titles is a body class blog.css draws from, coloured by the
// theme CSS; the tag hash is a plain flag the templates read.
func TestTitleRuleAndTagHash(t *testing.T) {