mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-03-27 22:01:46 +02:00
40 lines
1007 B
Go
40 lines
1007 B
Go
package commit
|
|
|
|
import (
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
"github.com/jesseduffield/lazygit/pkg/integration/helpers"
|
|
"github.com/jesseduffield/lazygit/pkg/integration/types"
|
|
)
|
|
|
|
var NewBranch = helpers.NewTest(helpers.NewTestArgs{
|
|
Description: "Creating a new branch from a commit",
|
|
ExtraCmdArgs: "",
|
|
Skip: false,
|
|
SetupConfig: func(config *config.AppConfig) {},
|
|
SetupRepo: func(shell types.Shell) {
|
|
shell.
|
|
EmptyCommit("commit 1").
|
|
EmptyCommit("commit 2").
|
|
EmptyCommit("commit 3")
|
|
},
|
|
Run: func(shell types.Shell, input types.Input, assert types.Assert, keys config.KeybindingConfig) {
|
|
assert.CommitCount(3)
|
|
|
|
input.SwitchToCommitsWindow()
|
|
assert.CurrentViewName("commits")
|
|
input.NextItem()
|
|
|
|
input.PressKeys(keys.Universal.New)
|
|
|
|
assert.CurrentViewName("confirmation")
|
|
|
|
branchName := "my-branch-name"
|
|
input.Type(branchName)
|
|
input.Confirm()
|
|
|
|
assert.CommitCount(2)
|
|
assert.HeadCommitMessage("commit 2")
|
|
assert.CurrentBranchName(branchName)
|
|
},
|
|
})
|