diff options
Diffstat (limited to 'internal/web/web_test.go')
| -rw-r--r-- | internal/web/web_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/web/web_test.go b/internal/web/web_test.go index 42d29e4..205e42f 100644 --- a/internal/web/web_test.go +++ b/internal/web/web_test.go @@ -133,6 +133,23 @@ func TestThemeNormalizeAndCSS(t *testing.T) { } } +// 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) { + th := DefaultTheme() + if th.TitleRuleClass() != "" || th.TagHash || strings.Contains(th.CSS(), ".page-title") { + t.Errorf("defaults: %+v", th) + } + th = ThemeFromForm(th, url.Values{"title_rule": {"dots"}, "tag_hash": {"on"}, "link_color": {"#b03a48"}}) + if th.TitleRuleClass() != "titles-dots" || !th.TagHash || !strings.Contains(th.CSS(), ".page-title, .post-title { border-color:#b03a48; }") { + t.Errorf("from form: %+v\n%s", th, th.CSS()) + } + th = ThemeFromForm(th, url.Values{"title_rule": {"neon"}}) + if th.TitleRuleClass() != "" || th.TagHash { + t.Errorf("junk rule falls back, unticked box is off: %+v", th) + } +} + // An uploaded font is declared as a face and put first in the stack, the // built-in choice behind it; the heading font falls back to the text's stack. func TestCustomFontCSS(t *testing.T) { |
