(t *testing.T)
| 155 | } |
| 156 | |
| 157 | func 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 | |
| 195 | func TestSettingsOverlay_CancelEdit(t *testing.T) { |
| 196 | s := NewSettingsOverlay() |
nothing calls this directly
no test coverage detected