aboutsummaryrefslogtreecommitdiff
path: root/internal/web/server_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/web/server_test.go')
-rw-r--r--internal/web/server_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/web/server_test.go b/internal/web/server_test.go
index 925ea18..5f15796 100644
--- a/internal/web/server_test.go
+++ b/internal/web/server_test.go
@@ -437,6 +437,35 @@ func TestVsetEmptyShowsNothing(t *testing.T) {
}
}
+// TestTraditionalDropsPhantomBT guards the traditional case of "no version ->
+// nothing": a phantom checked-but-hidden bt (carried over from modern) must not
+// substitute to wuj on an explicit form submit, but a fresh visit keeps the
+// bt->wuj default.
+func TestTraditionalDropsPhantomBT(t *testing.T) {
+ srv := NewServer(config.Default())
+
+ // Explicit submit, only the phantom bt "checked": empty pane.
+ phantom := httptest.NewRecorder()
+ srv.ServeHTTP(phantom, httptest.NewRequest("GET", "/readings?vset=1&lectionary=traditional&v=bt", nil))
+ if b := strings.TrimSpace(phantom.Body.String()); b != "" {
+ t.Errorf("traditional vset+v=bt should be empty, got %d bytes", len(b))
+ }
+
+ // Explicit submit, bt phantom + a real corpus version: still renders it.
+ withWuj := httptest.NewRecorder()
+ srv.ServeHTTP(withWuj, httptest.NewRequest("GET", "/readings?vset=1&lectionary=traditional&v=bt&v=wuj", nil))
+ if !strings.Contains(withWuj.Body.String(), "block") {
+ t.Errorf("traditional vset+v=bt+v=wuj should still render wuj")
+ }
+
+ // Fresh visit (no vset): the bt->wuj default is kept and wuj is checked.
+ fresh := httptest.NewRecorder()
+ srv.ServeHTTP(fresh, httptest.NewRequest("GET", "/?lectionary=traditional", nil))
+ if !strings.Contains(fresh.Body.String(), `value="wuj" checked`) {
+ t.Errorf("fresh traditional visit should default to wuj (checked)")
+ }
+}
+
// TestReaderPaneOutsideForm guards the mono fix: #pane must render AFTER the
// controls </form> so its reading text inherits body's --font-reading (which
// the mono toggle flips) instead of the form's --font-ui.