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

40 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: "",
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-08-22 20:02:32 +10:00
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
2022-12-26 16:49:54 +11:00
input.SwitchToBranchesView()
2022-08-07 22:09:39 +10:00
input.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-27 11:34:41 +11:00
input.Prompt().
Title(Equals("Branch name:")).
Type("branch-to").
SuggestionTopLines(Contains("branch-to-checkout")).
SelectFirstSuggestion().
Confirm()
2022-08-07 22:09:39 +10:00
2022-12-27 15:22:31 +11:00
assert.Model().CurrentBranchName("branch-to-checkout")
2022-08-07 22:09:39 +10:00
},
})