diff options
Diffstat (limited to 'pkg/integration')
-rw-r--r-- | pkg/integration/tests/custom_commands/suggestions_preset.go | 64 | ||||
-rw-r--r-- | pkg/integration/tests/test_list.go | 1 |
2 files changed, 65 insertions, 0 deletions
diff --git a/pkg/integration/tests/custom_commands/suggestions_preset.go b/pkg/integration/tests/custom_commands/suggestions_preset.go new file mode 100644 index 000000000..894e3b1fe --- /dev/null +++ b/pkg/integration/tests/custom_commands/suggestions_preset.go @@ -0,0 +1,64 @@ +package custom_commands + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var SuggestionsPreset = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Using a custom command that uses a suggestions preset in a prompt step", + ExtraCmdArgs: []string{}, + Skip: false, + SetupRepo: func(shell *Shell) { + shell.NewBranch("branch-one") + shell.EmptyCommit("blah") + shell.NewBranch("branch-two") + shell.EmptyCommit("blah") + shell.NewBranch("branch-three") + shell.EmptyCommit("blah") + shell.NewBranch("branch-four") + shell.EmptyCommit("blah") + }, + SetupConfig: func(cfg *config.AppConfig) { + cfg.UserConfig.CustomCommands = []config.CustomCommand{ + { + Key: "a", + Context: "localBranches", + Command: `git checkout {{.Form.Branch}}`, + Prompts: []config.CustomCommandPrompt{ + { + Key: "Branch", + Type: "input", + Title: "Enter a branch name", + SuggestionsPreset: "branches", + }, + }, + }, + } + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Branches(). + Focus(). + Lines( + Contains("branch-four").IsSelected(), + Contains("branch-three"), + Contains("branch-two"), + Contains("branch-one"), + ). + Press("a") + + t.ExpectPopup().Prompt(). + Title(Equals("Enter a branch name")). + Type("three"). + SuggestionLines(Contains("branch-three")). + ConfirmFirstSuggestion() + + t.Views().Branches(). + Lines( + Contains("branch-three").IsSelected(), + Contains("branch-four"), + Contains("branch-two"), + Contains("branch-one"), + ) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index 1dd1a48e7..e0800f7bd 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -77,6 +77,7 @@ var tests = []*components.IntegrationTest{ custom_commands.MenuFromCommandsOutput, custom_commands.MultiplePrompts, custom_commands.OmitFromHistory, + custom_commands.SuggestionsPreset, diff.Diff, diff.DiffAndApplyPatch, diff.DiffCommits, |