(t *testing.T)
| 22 | } |
| 23 | |
| 24 | func 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 | |
| 37 | func TestMenu_LetterKeysIgnoredWithoutShortcuts(t *testing.T) { |
| 38 | menu := NewMenu( |
nothing calls this directly
no test coverage detected
searching dependent graphs…