MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestCtrlLClosesPopover

Function TestCtrlLClosesPopover

internal/tui/tui_test.go:1507–1524  ·  view source on GitHub ↗

TestCtrlLClosesPopover: Ctrl+L clears the popover along with the prompt. Left open on stale suggestions, the next Enter would take the has-selection path and insert a ghost command into the freshly emptied prompt.

(t *testing.T)

Source from the content-addressed store, hash-verified

1505
1506// TestCtrlLClearsPromptNotScrollback: Ctrl+L matches Claude Code: it
1507// clears the typed input and forces a terminal redraw, but conversation
1508// scrollback stays. /clear is the only way to wipe history.
1509func TestCtrlLClearsPromptNotScrollback(t *testing.T) {
1510 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
1511 m.ta.SetValue("half-written thought")
1512 m.scroll.WriteString("prior assistant message\n")
1513
1514 out, cmd := m.Update(tea.KeyMsg{Type: tea.KeyCtrlL})
1515 om := out.(Model)
1516
1517 if om.ta.Value() != "" {
1518 t.Fatalf("Ctrl+L must clear typed prompt, got %q", om.ta.Value())
1519 }
1520 if !strings.Contains(om.scroll.String(), "prior assistant message") {
1521 t.Fatalf("Ctrl+L must NOT wipe scrollback, got %q", om.scroll.String())
1522 }
1523 if cmd == nil {
1524 t.Fatal("Ctrl+L should return tea.ClearScreen cmd to force terminal redraw")
1525 }
1526}
1527

Callers

nothing calls this directly

Calls 4

newTestModelFunction · 0.85
popoverOpenMethod · 0.80
ValueMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected