(t *testing.T)
| 119 | if len(v.list.entries) != 0 || !v.requests.loading { |
| 120 | t.Fatalf("stale page changed feed: entries:%d loading:%v", len(v.list.entries), v.requests.loading) |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | func TestJournalScrollNearBottomLoadsMore(t *testing.T) { |
| 125 | v := loadedJournalView(journalEntries(10)) |
| 126 | v.nextPage = "next" |
| 127 | v.Resize(80, 6) |
| 128 | for range 6 { |
| 129 | v.HandleContentKey(keyPress("down")) |
| 130 | } |
| 131 | if !v.loadingMore { |
| 132 | t.Fatal("scrolling near the bottom should load another page") |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | func TestJournalSearchAndClear(t *testing.T) { |
| 137 | v := loadedJournalView(journalEntries(1)) |
| 138 | if cmd := v.HandleContentKey(keyPress("/")); cmd == nil || v.prompt == nil { |
| 139 | t.Fatal("/ should open and focus search") |
| 140 | } |
| 141 | v.prompt.input.SetValue("quarterly planning") |
| 142 | cmd := v.HandleContentKey(keyPress("enter")) |
| 143 | if cmd == nil || v.prompt != nil || v.query != "quarterly planning" || v.requests.kind != journalRequestFeed { |
| 144 | t.Fatalf("search state = cmd:%v prompt:%v query:%q kind:%v", cmd != nil, v.prompt != nil, v.query, v.requests.kind) |
| 145 | } |
| 146 | v.Update(journalPageLoadedMsg{requestResult: currentJournalResult(v)}) |
| 147 | if got := stripANSI(v.View()); !strings.Contains(got, "Search: quarterly planning · 0 results") { |
| 148 | t.Fatalf("search empty state = %q", got) |
| 149 | } |
nothing calls this directly
no test coverage detected