MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / TestSettingsOverlay_Navigation

Function TestSettingsOverlay_Navigation

internal/tui/settings_test.go:64–99  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

62}
63
64func TestSettingsOverlay_Navigation(t *testing.T) {
65 s := NewSettingsOverlay()
66 s.LoadFromConfig(config.Default())
67
68 if s.selectedIndex != 0 {
69 t.Fatalf("expected initial index=0, got %d", s.selectedIndex)
70 }
71
72 s.MoveDown()
73 if s.selectedIndex != 1 {
74 t.Errorf("expected index=1 after MoveDown, got %d", s.selectedIndex)
75 }
76
77 s.MoveDown()
78 if s.selectedIndex != 2 {
79 t.Errorf("expected index=2 after second MoveDown, got %d", s.selectedIndex)
80 }
81
82 // Can't go beyond last item
83 s.MoveDown()
84 if s.selectedIndex != 2 {
85 t.Errorf("expected index=2 (clamped), got %d", s.selectedIndex)
86 }
87
88 s.MoveUp()
89 if s.selectedIndex != 1 {
90 t.Errorf("expected index=1 after MoveUp, got %d", s.selectedIndex)
91 }
92
93 // Can't go before first item
94 s.MoveUp()
95 s.MoveUp()
96 if s.selectedIndex != 0 {
97 t.Errorf("expected index=0 (clamped), got %d", s.selectedIndex)
98 }
99}
100
101func TestSettingsOverlay_ToggleBool(t *testing.T) {
102 s := NewSettingsOverlay()

Callers

nothing calls this directly

Calls 5

LoadFromConfigMethod · 0.95
MoveDownMethod · 0.95
MoveUpMethod · 0.95
DefaultFunction · 0.92
NewSettingsOverlayFunction · 0.85

Tested by

no test coverage detected