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

Function TestMenu_ViewWithShortcuts

internal/ui/menu_test.go:24–35  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22}
23
24func TestMenu_ViewWithShortcuts(t *testing.T) {
25 menu := NewMenu(
26 MenuItem{Label: "One", Key: 0, Shortcut: WithHelp(NewKeyBinding("x"), "x", "")},
27 MenuItem{Label: "Two", Key: 1, Shortcut: WithHelp(NewKeyBinding("y"), "y", "")},
28 )
29 assert.True(t, menu.hasShortcuts)
30
31 menu.SetWidth(20)
32 view := ansi.Strip(menu.View())
33 assert.Contains(t, view, "x")
34 assert.Contains(t, view, "y")
35}
36
37func TestMenu_LetterKeysIgnoredWithoutShortcuts(t *testing.T) {
38 menu := NewMenu(

Callers

nothing calls this directly

Calls 5

SetWidthMethod · 0.95
ViewMethod · 0.95
NewMenuFunction · 0.85
WithHelpFunction · 0.85
NewKeyBindingFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…