Skip to content

Commit 932e01b

Browse files
committed
Add test for crashing on empty menu
1 parent 373f24c commit 932e01b

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

pkg/integration/tests/test_list.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ var tests = []*components.IntegrationTest{
211211
tag.Reset,
212212
ui.Accordion,
213213
ui.DoublePopup,
214+
ui.EmptyMenu,
214215
ui.SwitchTabFromMenu,
215216
undo.UndoCheckoutAndDrop,
216217
undo.UndoDrop,
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package ui
2+
3+
import (
4+
"github.com/jesseduffield/lazygit/pkg/config"
5+
. "github.com/jesseduffield/lazygit/pkg/integration/components"
6+
)
7+
8+
var EmptyMenu = NewIntegrationTest(NewIntegrationTestArgs{
9+
Description: "Verify that we don't crash on an empty menu",
10+
ExtraCmdArgs: []string{},
11+
Skip: false,
12+
SetupConfig: func(config *config.AppConfig) {},
13+
SetupRepo: func(shell *Shell) {
14+
},
15+
Run: func(t *TestDriver, keys config.KeybindingConfig) {
16+
t.Views().Files().
17+
IsFocused().
18+
Press(keys.Universal.OptionMenu)
19+
20+
t.Views().Menu().
21+
IsFocused().
22+
// a string that filters everything out
23+
FilterOrSearch("ljasldkjaslkdjalskdjalsdjaslkd").
24+
IsEmpty().
25+
Press(keys.Universal.Select)
26+
27+
// back in the files view, selecting the non-existing menu item was a no-op
28+
t.Views().Files().
29+
IsFocused()
30+
},
31+
})

0 commit comments

Comments
 (0)