MCPcopy
hub / github.com/charmbracelet/huh / TestTextExternalEditorHidden

Function TestTextExternalEditorHidden

huh_test.go:388–410  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

386}
387
388func TestTextExternalEditorHidden(t *testing.T) {
389 field := NewText().ExternalEditor(false)
390 f := NewForm(NewGroup(field))
391 f.Update(f.Init())
392
393 // Type Huh in the form.
394 f = typeText(f, text)
395 view := viewModel(f)
396
397 if !strings.Contains(view, text) {
398 t.Log(pretty.Render(view))
399 t.Error("Expected field to contain " + text)
400 }
401
402 if strings.Contains(view, "ctrl+e open editor") {
403 t.Log(pretty.Render(view))
404 t.Error("Expected field to contain help without ctrl+e.")
405 }
406
407 if field.GetValue() != text {
408 t.Error("Expected field value to be " + text)
409 }
410}
411
412func TestConfirm(t *testing.T) {
413 field := NewConfirm().Title("Are you sure?")

Callers

nothing calls this directly

Calls 10

UpdateMethod · 0.95
InitMethod · 0.95
NewTextFunction · 0.85
NewFormFunction · 0.85
NewGroupFunction · 0.85
typeTextFunction · 0.85
viewModelFunction · 0.85
ExternalEditorMethod · 0.80
ErrorMethod · 0.65
GetValueMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…