aboutsummaryrefslogtreecommitdiffstats
path: root/internal/web/web_test.go
diff options
context:
space:
mode:
authorgrm <grm@eyesin.space>2026-09-17 16:44:11 +0300
committergrm <grm@eyesin.space>2026-09-17 16:44:11 +0300
commitf79f97800f7f9ba1ef2b3e2e56040a952a9668a5 (patch)
treef054c3b030911336e39c57a1498a272bb30d7bc0 /internal/web/web_test.go
parentd0601f06c080a8eb8d781fdd0e3338cd7ed42690 (diff)
downloadblogspace-f79f97800f7f9ba1ef2b3e2e56040a952a9668a5.tar.gz
blogspace-f79f97800f7f9ba1ef2b3e2e56040a952a9668a5.tar.bz2
blogspace-f79f97800f7f9ba1ef2b3e2e56040a952a9668a5.zip
Let the header and footer follow the main column
With keep_columns and empty side columns the posts sit in a centred column while the header and footer still run edge to edge, which reads as two different pages stacked. The new switch insets their content by the column widths (the backgrounds stay full width, phones are untouched) so the whole page lines up as one column — the look a single-column site expects, without bringing back a content max-width. 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.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/internal/web/web_test.go b/internal/web/web_test.go
index a13697c..b707339 100644
--- a/internal/web/web_test.go
+++ b/internal/web/web_test.go
@@ -129,7 +129,7 @@ func TestLayoutTheme(t *testing.T) {
// The layout switches ride in the design form: the areas are checkboxes, so an unticked one is off.
th := ThemeFromForm(DefaultTheme(), url.Values{"left_width": {"40"}, "right_width": {"40"}, "keep_columns": {"on"}, "header_on": {"on"}, "left_on": {"on"}, "right_on": {"on"},
"posts_per_page": {"20"}, "title_size": {"large"}, "footer_align": {"left"}})
- if th.LeftWidth != 40 || th.RightWidth != 30 || th.MainWidth() != 30 || !th.KeepColumns {
+ if th.LeftWidth != 40 || th.RightWidth != 30 || th.MainWidth() != 30 || !th.KeepColumns || th.AlignToMain {
t.Errorf("the right column should give way: %+v", th)
}
if th.FooterOn || !th.HeaderOn || th.PostsPerPage != 20 || th.TitleSize != "large" || th.FooterAlign != "left" {
@@ -149,6 +149,17 @@ func TestLayoutTheme(t *testing.T) {
t.Errorf("css missing %q:\n%s", want, css)
}
}
+ if strings.Contains(css, ".site-header .wrap") {
+ t.Error("header insets emitted without align_to_main")
+ }
+ th = ThemeFromForm(th, url.Values{"left_width": {"15"}, "right_width": {"20"}, "align_to_main": {"on"}})
+ css = th.CSS()
+ for _, want := range []string{"body.has-left .site-header .wrap, body.has-left .site-footer .wrap { padding-left:calc(1em + 15%); }",
+ "body.has-right .site-header .wrap, body.has-right .site-footer .wrap { padding-right:calc(1em + 20%); }"} {
+ if !strings.Contains(css, want) {
+ t.Errorf("css missing %q:\n%s", want, css)
+ }
+ }
th.LeftOn = false
if th.AreaOn("left") || !th.AreaOn("above") || !th.AreaOn("bogus") {
t.Errorf("area switches: %+v", th)