TestResetClearsChips: Reset empties store and spans, leaving only new text.
(t *testing.T)
| 320 | |
| 321 | // TestResetClearsChips: Reset empties store and spans, leaving only new text. |
| 322 | func TestResetClearsChips(t *testing.T) { |
| 323 | p := newChippablePrompt() |
| 324 | p, _ = p.Update(pasteKey(makePaste(10))) |
| 325 | if len(p.spans) != 1 { |
| 326 | t.Fatal("precondition: one chip") |
| 327 | } |
| 328 | p.Reset() |
| 329 | if p.DisplayValue() != "" { |
| 330 | t.Fatalf("Reset should empty the textarea, got %q", p.DisplayValue()) |
| 331 | } |
| 332 | if len(p.spans) != 0 || len(p.store) != 0 { |
| 333 | t.Fatal("Reset should clear chip state") |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | // TestSetValueClearsChips: SetValue installs plain text and drops prior chips, |
| 338 | // used by slash-popover Tab-completion, where chips can't be part of a replacement. |
nothing calls this directly
no test coverage detected