1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-15 11:56:37 +02:00
2022-08-11 21:24:15 +10:00

41 lines
1.1 KiB
Go

package branch
import (
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/integration/types"
)
var Suggestions = types.NewTest(types.NewTestArgs{
Description: "Checking out a branch with name suggestions",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell types.Shell) {
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")
},
Run: func(shell types.Shell, input types.Input, assert types.Assert, keys config.KeybindingConfig) {
input.SwitchToBranchesWindow()
input.PushKeys(keys.Branches.CheckoutBranchByName)
assert.CurrentViewName("confirmation")
input.Type("branch-to")
input.PushKeys(keys.Universal.TogglePanel)
assert.CurrentViewName("suggestions")
// we expect the first suggestion to be the branch we want because it most
// closely matches what we typed in
input.Confirm()
assert.CurrentBranchName("branch-to-checkout")
},
})