TestCtrlCIdleArmsThenQuits: first Ctrl+C in idle arms the status bar and returns a Tick cmd; second Ctrl+C before the window expires returns Quit.
(t *testing.T)
| 140 | // TestCtrlCIdleArmsThenQuits: first Ctrl+C in idle arms the status bar and |
| 141 | // returns a Tick cmd; second Ctrl+C before the window expires returns Quit. |
| 142 | func TestCtrlCIdleArmsThenQuits(t *testing.T) { |
| 143 | m := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 144 | first, cmd1 := m.Update(tea.KeyMsg{Type: tea.KeyCtrlC}) |
| 145 | fm := first.(Model) |
| 146 | if fm.quitArmedAt.IsZero() { |
| 147 | t.Fatal("first Ctrl+C should arm quitArmedAt") |
| 148 | } |
| 149 | if !strings.Contains(fm.renderStatusBar(), "press Ctrl+C again") { |
| 150 | t.Fatalf("status bar should show arming hint, got: %s", fm.renderStatusBar()) |
| 151 | } |
| 152 | if cmd1 == nil { |
| 153 | t.Fatal("first press should return tea.Tick cmd") |
| 154 | } |
| 155 | _, cmd2 := fm.Update(tea.KeyMsg{Type: tea.KeyCtrlC}) |
| 156 | if cmd2 == nil { |
| 157 | t.Fatal("second Ctrl+C should return tea.Quit cmd") |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | // TestCtrlCPopoverClosesInsteadOfQuitting: with the popover open and no |
| 162 | // in-flight op, Ctrl+C dismisses the popover and does not arm quit. |
nothing calls this directly
no test coverage detected