1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-26 05:37:18 +02:00

39 lines
1.1 KiB
Go
Raw Normal View History

2022-08-07 22:09:39 +10:00
package branch
import (
"github.com/jesseduffield/lazygit/pkg/config"
2022-08-22 20:02:32 +10:00
. "github.com/jesseduffield/lazygit/pkg/integration/components"
2022-08-07 22:09:39 +10:00
)
2022-08-22 20:02:32 +10:00
var Suggestions = NewIntegrationTest(NewIntegrationTestArgs{
2022-08-07 22:09:39 +10:00
Description: "Checking out a branch with name suggestions",
ExtraCmdArgs: []string{},
2022-08-07 22:09:39 +10:00
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
2022-08-22 20:02:32 +10:00
SetupRepo: func(shell *Shell) {
2022-08-07 22:09:39 +10:00
shell.
EmptyCommit("my commit message").
NewBranch("new-branch").
NewBranch("new-branch-2").
NewBranch("new-branch-3").
NewBranch("branch-to-checkout").
NewBranch("other-new-branch-2").
NewBranch("other-new-branch-3")
},
2022-12-27 21:47:37 +11:00
Run: func(t *TestDriver, keys config.KeybindingConfig) {
2022-12-27 21:35:36 +11:00
t.Views().Branches().
Focus().
Press(keys.Branches.CheckoutBranchByName)
2022-08-07 22:09:39 +10:00
// we expect the first suggestion to be the branch we want because it most
// closely matches what we typed in
2022-12-28 11:00:22 +11:00
t.ExpectPopup().Prompt().
2022-12-27 11:34:41 +11:00
Title(Equals("Branch name:")).
Type("branch-to").
SuggestionTopLines(Contains("branch-to-checkout")).
2022-12-28 10:41:42 +11:00
ConfirmFirstSuggestion()
2022-08-07 22:09:39 +10:00
2022-12-27 22:52:20 +11:00
t.Git().CurrentBranchName("branch-to-checkout")
2022-08-07 22:09:39 +10:00
},
})