mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-31 14:24:25 +03:00
add create tag from commit test
This commit is contained in:
@ -258,7 +258,7 @@ type KeybindingCommitsConfig struct {
|
|||||||
CherryPickCopy string `yaml:"cherryPickCopy"`
|
CherryPickCopy string `yaml:"cherryPickCopy"`
|
||||||
CherryPickCopyRange string `yaml:"cherryPickCopyRange"`
|
CherryPickCopyRange string `yaml:"cherryPickCopyRange"`
|
||||||
PasteCommits string `yaml:"pasteCommits"`
|
PasteCommits string `yaml:"pasteCommits"`
|
||||||
TagCommit string `yaml:"tagCommit"`
|
CreateTag string `yaml:"tagCommit"`
|
||||||
CheckoutCommit string `yaml:"checkoutCommit"`
|
CheckoutCommit string `yaml:"checkoutCommit"`
|
||||||
ResetCherryPick string `yaml:"resetCherryPick"`
|
ResetCherryPick string `yaml:"resetCherryPick"`
|
||||||
CopyCommitAttributeToClipboard string `yaml:"copyCommitAttributeToClipboard"`
|
CopyCommitAttributeToClipboard string `yaml:"copyCommitAttributeToClipboard"`
|
||||||
@ -544,7 +544,7 @@ func GetDefaultConfig() *UserConfig {
|
|||||||
CherryPickCopy: "c",
|
CherryPickCopy: "c",
|
||||||
CherryPickCopyRange: "C",
|
CherryPickCopyRange: "C",
|
||||||
PasteCommits: "v",
|
PasteCommits: "v",
|
||||||
TagCommit: "T",
|
CreateTag: "T",
|
||||||
CheckoutCommit: "<space>",
|
CheckoutCommit: "<space>",
|
||||||
ResetCherryPick: "<c-R>",
|
ResetCherryPick: "<c-R>",
|
||||||
CopyCommitAttributeToClipboard: "y",
|
CopyCommitAttributeToClipboard: "y",
|
||||||
|
@ -132,7 +132,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
|
|||||||
Description: self.c.Tr.LcRevertCommit,
|
Description: self.c.Tr.LcRevertCommit,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Key: opts.GetKey(opts.Config.Commits.TagCommit),
|
Key: opts.GetKey(opts.Config.Commits.CreateTag),
|
||||||
Handler: self.checkSelected(self.createTag),
|
Handler: self.checkSelected(self.createTag),
|
||||||
Description: self.c.Tr.LcTagCommit,
|
Description: self.c.Tr.LcTagCommit,
|
||||||
},
|
},
|
||||||
|
51
pkg/integration/tests/commit/create_tag.go
Normal file
51
pkg/integration/tests/commit/create_tag.go
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package commit
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||||
|
)
|
||||||
|
|
||||||
|
var CreateTag = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
|
Description: "Create a new tag on a commit",
|
||||||
|
ExtraCmdArgs: "",
|
||||||
|
Skip: false,
|
||||||
|
SetupConfig: func(config *config.AppConfig) {},
|
||||||
|
SetupRepo: func(shell *Shell) {
|
||||||
|
shell.EmptyCommit("one")
|
||||||
|
shell.EmptyCommit("two")
|
||||||
|
},
|
||||||
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
|
t.Views().Commits().
|
||||||
|
Focus().
|
||||||
|
Lines(
|
||||||
|
Contains("two").IsSelected(),
|
||||||
|
Contains("one"),
|
||||||
|
).
|
||||||
|
Press(keys.Commits.CreateTag)
|
||||||
|
|
||||||
|
t.ExpectPopup().Menu().
|
||||||
|
Title(Equals("Create tag")).
|
||||||
|
Select(Contains("lightweight")).
|
||||||
|
Confirm()
|
||||||
|
|
||||||
|
t.ExpectPopup().Prompt().
|
||||||
|
Title(Equals("Tag name:")).
|
||||||
|
Type("new-tag").
|
||||||
|
Confirm()
|
||||||
|
|
||||||
|
t.Views().Commits().
|
||||||
|
Lines(
|
||||||
|
MatchesRegexp(`new-tag.*two`).IsSelected(),
|
||||||
|
MatchesRegexp(`one`),
|
||||||
|
)
|
||||||
|
|
||||||
|
t.Views().Tags().
|
||||||
|
Focus().
|
||||||
|
Lines(
|
||||||
|
MatchesRegexp(`new-tag.*two`).IsSelected(),
|
||||||
|
)
|
||||||
|
|
||||||
|
t.Git().
|
||||||
|
TagNamesAt("HEAD", []string{"new-tag"})
|
||||||
|
},
|
||||||
|
})
|
@ -41,6 +41,7 @@ var tests = []*components.IntegrationTest{
|
|||||||
cherry_pick.CherryPickConflicts,
|
cherry_pick.CherryPickConflicts,
|
||||||
commit.Commit,
|
commit.Commit,
|
||||||
commit.CommitMultiline,
|
commit.CommitMultiline,
|
||||||
|
commit.CreateTag,
|
||||||
commit.DiscardOldFileChange,
|
commit.DiscardOldFileChange,
|
||||||
commit.NewBranch,
|
commit.NewBranch,
|
||||||
commit.Revert,
|
commit.Revert,
|
||||||
|
Reference in New Issue
Block a user