aboutsummaryrefslogtreecommitdiffstats
path: root/internal/web/web_test.go
diff options
context:
space:
mode:
authorgrm <grm@eyesin.space>2026-09-17 21:37:46 +0300
committergrm <grm@eyesin.space>2026-09-17 21:37:46 +0300
commitb233445a73168994087356d45b5dc7dd6a07aa8e (patch)
treed08b554607c5ab2e707dd607ab5bfa88c62e5274 /internal/web/web_test.go
parente96bbec551c0388e972894b349413fa6ef607352 (diff)
downloadblogspace-b233445a73168994087356d45b5dc7dd6a07aa8e.tar.gz
blogspace-b233445a73168994087356d45b5dc7dd6a07aa8e.tar.bz2
blogspace-b233445a73168994087356d45b5dc7dd6a07aa8e.zip
Add a rule under page and post titles, and tags shown with a # in front
Two Design tab options in the Posts section. The title rule reuses the header rule's kinds (line, dots, stripes): a body class blog.css draws from — width and style only, so the theme CSS's link colour is not reset — ending at a floated thumbnail instead of running under it. The tag hash is applied everywhere tags are listed: under posts, in both tag modules and in the tag page's title. 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.go17
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) {