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

Function TestSettingsOverlay_StringEditing

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

Source from the content-addressed store, hash-verified

155}
156
157func TestSettingsOverlay_StringEditing(t *testing.T) {
158 s := NewSettingsOverlay()
159 s.LoadFromConfig(config.Default())
160
161 // Selected item is "Setup command" (index 0)
162 if s.IsEditing() {
163 t.Fatal("should not be editing initially")
164 }
165
166 s.StartEditing()
167 if !s.IsEditing() {
168 t.Fatal("should be editing after StartEditing")
169 }
170 if s.editBuffer != "" {
171 t.Errorf("expected empty edit buffer, got '%s'", s.editBuffer)
172 }
173
174 s.AddEditChar('n')
175 s.AddEditChar('p')
176 s.AddEditChar('m')
177 if s.editBuffer != "npm" {
178 t.Errorf("expected 'npm', got '%s'", s.editBuffer)
179 }
180
181 s.DeleteEditChar()
182 if s.editBuffer != "np" {
183 t.Errorf("expected 'np' after delete, got '%s'", s.editBuffer)
184 }
185
186 s.ConfirmEdit()
187 if s.IsEditing() {
188 t.Fatal("should not be editing after ConfirmEdit")
189 }
190 if s.items[0].StringVal != "np" {
191 t.Errorf("expected StringVal='np', got '%s'", s.items[0].StringVal)
192 }
193}
194
195func TestSettingsOverlay_CancelEdit(t *testing.T) {
196 s := NewSettingsOverlay()

Callers

nothing calls this directly

Calls 8

LoadFromConfigMethod · 0.95
IsEditingMethod · 0.95
StartEditingMethod · 0.95
AddEditCharMethod · 0.95
DeleteEditCharMethod · 0.95
ConfirmEditMethod · 0.95
DefaultFunction · 0.92
NewSettingsOverlayFunction · 0.85

Tested by

no test coverage detected