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

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