summaryrefslogtreecommitdiff
path: root/internal/tui/tui_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-06 18:12:39 +0200
committerPaul Buetow <paul@buetow.org>2026-03-06 18:12:39 +0200
commitb566bc141e971ae2a7634c9d836f2ad8b0a62402 (patch)
tree111aa195010261c59ae6f53eafa30e9edfbbd212 /internal/tui/tui_test.go
parent99a6cf4787fd92a25a53acbc9c0bae8bca87cc96 (diff)
fix(tui): close help overlay on q instead of quitting
Diffstat (limited to 'internal/tui/tui_test.go')
-rw-r--r--internal/tui/tui_test.go28
1 files changed, 27 insertions, 1 deletions
diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.go
index 7c1d886..84d3632 100644
--- a/internal/tui/tui_test.go
+++ b/internal/tui/tui_test.go
@@ -756,7 +756,7 @@ func TestHelpOverlayOpensWithUppercaseHAndClosesWithEsc(t *testing.T) {
t.Fatalf("expected help overlay to become visible after H")
}
view := m.View().Content
- if !strings.Contains(view, "Help") || !strings.Contains(view, "Global") || !strings.Contains(view, "Esc close") {
+ if !strings.Contains(view, "Help") || !strings.Contains(view, "Global") || !strings.Contains(view, "Esc/q close") {
t.Fatalf("expected global help overlay content, got %q", view)
}
@@ -770,6 +770,32 @@ func TestHelpOverlayOpensWithUppercaseHAndClosesWithEsc(t *testing.T) {
}
}
+func TestHelpOverlayClosesWithQWithoutQuitting(t *testing.T) {
+ m := NewModel(-1, func(context.Context) error { return nil })
+ m.screen = ScreenDashboard
+ m.attaching = false
+ m.width = 100
+ m.height = 30
+
+ next, _ := m.Update(tea.KeyPressMsg{Code: []rune{'H'}[0], Text: string([]rune{'H'})})
+ m = next.(Model)
+ if !m.helpOverlayVisible {
+ t.Fatalf("expected help overlay to become visible after H")
+ }
+
+ next, cmd := m.Update(tea.KeyPressMsg{Code: []rune{'q'}[0], Text: string([]rune{'q'})})
+ m = next.(Model)
+ if cmd != nil {
+ t.Fatalf("expected no quit command when closing help with q")
+ }
+ if m.helpOverlayVisible {
+ t.Fatalf("expected q to close help overlay")
+ }
+ if m.quitting {
+ t.Fatalf("expected q in help overlay not to set quitting state")
+ }
+}
+
func TestHelpOverlayCanOpenFromPIDPicker(t *testing.T) {
m := NewModel(-1, func(context.Context) error { return nil })
m.screen = ScreenPIDPicker