MCPcopy
hub / github.com/basecamp/once / TestHelp_RenderWraps

Function TestHelp_RenderWraps

internal/ui/help_test.go:54–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

52}
53
54func TestHelp_RenderWraps(t *testing.T) {
55 bindings := []key.Binding{
56 WithHelp(NewKeyBinding("a"), "a", "aaaaaaaaa"),
57 WithHelp(NewKeyBinding("b"), "b", "bbbbbbbbb"),
58 WithHelp(NewKeyBinding("c"), "c", "ccccccccc"),
59 }
60
61 h := NewHelp()
62 h.SetWidth(30) // narrow enough to force wrapping
63 h.SetBindings(bindings)
64 result := h.View()
65
66 lines := strings.Split(result, "\n")
67 assert.Greater(t, len(lines), 1, "should wrap to multiple lines")
68}

Callers

nothing calls this directly

Calls 6

SetWidthMethod · 0.95
SetBindingsMethod · 0.95
ViewMethod · 0.95
WithHelpFunction · 0.85
NewKeyBindingFunction · 0.85
NewHelpFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…