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

Function TestAltEnterInsertsNewline

internal/tui/tui_test.go:1530–1541  ·  view source on GitHub ↗

TestAltEnterInsertsNewline: Alt+Enter composes a multi-line prompt. The alt-flagged KeyEnter ("alt+enter") matches no textarea binding, so the flag must be stripped before forwarding or the key is a silent no-op and multi-line prompts can only be pasted.

(t *testing.T)

Source from the content-addressed store, hash-verified

1528
1529// TestCtrlLClosesPopover: Ctrl+L clears the popover along with the prompt.
1530// Left open on stale suggestions, the next Enter would take the has-selection
1531// path and insert a ghost command into the freshly emptied prompt.
1532func TestCtrlLClosesPopover(t *testing.T) {
1533 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
1534 o1, _ := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'/'}})
1535 m1 := o1.(Model)
1536 if !m1.popoverOpen() {
1537 t.Fatal("precondition: typing '/' opens the command popover")
1538 }
1539
1540 o2, _ := m1.Update(tea.KeyMsg{Type: tea.KeyCtrlL})
1541 m2 := o2.(Model)
1542 if m2.popoverOpen() {
1543 t.Fatal("Ctrl+L must close the popover along with the prompt")
1544 }

Callers

nothing calls this directly

Calls 4

newTestModelFunction · 0.85
SetValueMethod · 0.80
ValueMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected