From c9f3bf46f0de09edb796e35f3dcff349febf75c9 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Fri, 24 Jul 2026 10:32:28 +0200 Subject: dayinfo: show feast/day name + colour (modern niedziela + traditional missalemeum) in cli/tui/web; v0.5.0 --- internal/tui/tui_test.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'internal/tui/tui_test.go') diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.go index 85a8175..330259d 100644 --- a/internal/tui/tui_test.go +++ b/internal/tui/tui_test.go @@ -113,6 +113,41 @@ func TestBodyLinesLocalisesHeading(t *testing.T) { } } +// TestDayInfoLineShown checks the day-info line (celebration Name, plus +// its temporal Season if any) is rendered under the top header bar when +// the loaded source carries one, and that pageSize grows its chrome +// allowance to account for the extra line. +func TestDayInfoLineShown(t *testing.T) { + m := Model{ + cfg: config.Config{UILanguage: "en"}, + date: "2026-07-22", + dayInfo: liturgy.DayInfo{Name: "St. Mary Magdalene", Season: "Feria IV after VIII Sunday after Pentecost"}, + } + out := m.View() + if !strings.Contains(out, "St. Mary Magdalene") { + t.Errorf("View() missing day-info name: %q", out) + } + if !strings.Contains(out, "Feria IV after VIII Sunday after Pentecost") { + t.Errorf("View() missing day-info season: %q", out) + } + if got := m.headerLines(); got != 2 { + t.Errorf("headerLines() = %d, want 2 when DayInfo.Name is set", got) + } +} + +// TestDayInfoLineOmittedWhenEmpty checks the header block stays a single +// line (headerLines() == 1) when the source yielded no DayInfo -- e.g. a +// harvested-sigla offline load, which carries citations only. +func TestDayInfoLineOmittedWhenEmpty(t *testing.T) { + m := Model{cfg: config.Config{UILanguage: "en"}, date: "2026-07-22"} + if line := m.dayInfoLine(); line != "" { + t.Errorf("dayInfoLine() = %q, want empty when DayInfo is zero", line) + } + if got := m.headerLines(); got != 1 { + t.Errorf("headerLines() = %d, want 1 when DayInfo is zero", got) + } +} + // TestFooterKeysLocalised checks the footer keybar text follows // cfg.UILanguage. func TestFooterKeysLocalised(t *testing.T) { -- cgit v1.3