1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-01 00:54:58 +02:00

add tap function

This commit is contained in:
Jesse Duffield
2022-12-27 21:25:11 +11:00
parent b166b8f776
commit 53e06b71ae
19 changed files with 210 additions and 230 deletions

View File

@ -28,7 +28,8 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{
input.ExpectCommitMessagePanel().Type(commitMessage).Confirm()
input.Model().CommitCount(1)
input.Model().HeadCommitMessage(Equals(commitMessage))
input.Model().
CommitCount(1).
HeadCommitMessage(Equals(commitMessage))
},
})

View File

@ -21,22 +21,22 @@ var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{
input.Views().Commits().
Focus().
SelectNextItem().
Lines(
Contains("commit 3"),
Contains("commit 2"),
Contains("commit 2").IsSelected(),
Contains("commit 1"),
).
SelectNextItem().
Press(keys.Universal.New)
Press(keys.Universal.New).
Tap(func() {
branchName := "my-branch-name"
input.ExpectPrompt().Title(Contains("New Branch Name")).Type(branchName).Confirm()
branchName := "my-branch-name"
input.ExpectPrompt().Title(Contains("New Branch Name")).Type(branchName).Confirm()
input.Model().CurrentBranchName(branchName)
input.Views().Commits().Lines(
Contains("commit 2"),
Contains("commit 1"),
)
input.Model().CurrentBranchName(branchName)
}).
Lines(
Contains("commit 2"),
Contains("commit 1"),
)
},
})

View File

@ -23,14 +23,13 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{
Lines(
Contains("first commit"),
).
Press(keys.Commits.RevertCommit)
input.ExpectConfirmation().
Title(Equals("Revert commit")).
Content(MatchesRegexp(`Are you sure you want to revert \w+?`)).
Confirm()
input.Views().Commits().IsFocused().
Press(keys.Commits.RevertCommit).
Tap(func() {
input.ExpectConfirmation().
Title(Equals("Revert commit")).
Content(MatchesRegexp(`Are you sure you want to revert \w+?`)).
Confirm()
}).
Lines(
Contains("Revert \"first commit\"").IsSelected(),
Contains("first commit"),

View File

@ -24,24 +24,24 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{
PressPrimaryAction(). // stage the file
PressEnter()
input.Views().StagingSecondary().IsFocused()
// we start with both lines having been staged
input.Views().StagingSecondary().Content(Contains("+myfile content"))
input.Views().StagingSecondary().Content(Contains("+with a second line"))
input.Views().Staging().Content(DoesNotContain("+myfile content"))
input.Views().Staging().Content(DoesNotContain("+with a second line"))
// unstage the selected line
input.Views().StagingSecondary().
PressPrimaryAction()
// the line should have been moved to the main view
input.Views().StagingSecondary().Content(DoesNotContain("+myfile content"))
input.Views().StagingSecondary().Content(Contains("+with a second line"))
input.Views().Staging().Content(Contains("+myfile content"))
input.Views().Staging().Content(DoesNotContain("+with a second line"))
input.Views().StagingSecondary().
IsFocused().
Tap(func() {
// we start with both lines having been staged
input.Views().StagingSecondary().Content(Contains("+myfile content"))
input.Views().StagingSecondary().Content(Contains("+with a second line"))
input.Views().Staging().Content(DoesNotContain("+myfile content"))
input.Views().Staging().Content(DoesNotContain("+with a second line"))
}).
// unstage the selected line
PressPrimaryAction().
Tap(func() {
// the line should have been moved to the main view
input.Views().StagingSecondary().Content(DoesNotContain("+myfile content"))
input.Views().StagingSecondary().Content(Contains("+with a second line"))
input.Views().Staging().Content(Contains("+myfile content"))
input.Views().Staging().Content(DoesNotContain("+with a second line"))
}).
Press(keys.Files.CommitChanges)
commitMessage := "my commit message"

View File

@ -36,11 +36,11 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{
// unstage the selected line
input.Views().StagingSecondary().
IsFocused().
PressPrimaryAction()
// the line should have been moved to the main view
input.Views().Staging().Content(Contains("+myfile content").DoesNotContain("+with a second line"))
input.Views().StagingSecondary().
PressPrimaryAction().
Tap(func() {
// the line should have been moved to the main view
input.Views().Staging().Content(Contains("+myfile content").DoesNotContain("+with a second line"))
}).
Content(DoesNotContain("+myfile content").Contains("+with a second line")).
Press(keys.Files.CommitChangesWithoutHook)

View File

@ -26,18 +26,16 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{
PressEnter()
input.Views().Staging().
IsFocused()
input.Views().StagingSecondary().Content(DoesNotContain("+myfile content"))
// stage the first line
input.Views().Staging().
PressPrimaryAction()
input.Views().Staging().Content(DoesNotContain("+myfile content"))
input.Views().StagingSecondary().Content(Contains("+myfile content"))
input.Views().Staging().
IsFocused().
Tap(func() {
input.Views().StagingSecondary().Content(DoesNotContain("+myfile content"))
}).
// stage the first line
PressPrimaryAction().
Tap(func() {
input.Views().Staging().Content(DoesNotContain("+myfile content"))
input.Views().StagingSecondary().Content(Contains("+myfile content"))
}).
Press(keys.Files.CommitChanges)
commitMessage := "my commit message"