mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
remove dependency on model
This commit is contained in:
@ -15,7 +15,8 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
shell.CreateFile("myfile2", "myfile2 content")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Model().CommitCount(0)
|
||||
t.Views().Commits().
|
||||
IsEmpty()
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
@ -28,8 +29,9 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
t.ExpectCommitMessagePanel().Type(commitMessage).Confirm()
|
||||
|
||||
t.Model().
|
||||
CommitCount(1).
|
||||
HeadCommitMessage(Equals(commitMessage))
|
||||
t.Views().Commits().
|
||||
Lines(
|
||||
Contains(commitMessage),
|
||||
)
|
||||
},
|
||||
})
|
||||
|
@ -14,7 +14,8 @@ var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
shell.CreateFile("myfile", "myfile content")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Model().CommitCount(0)
|
||||
t.Views().Commits().
|
||||
IsEmpty()
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
@ -23,8 +24,10 @@ var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
t.ExpectCommitMessagePanel().Type("first line").AddNewline().AddNewline().Type("third line").Confirm()
|
||||
|
||||
t.Model().CommitCount(1)
|
||||
t.Model().HeadCommitMessage(Equals("first line"))
|
||||
t.Views().Commits().
|
||||
Lines(
|
||||
Contains("first line"),
|
||||
)
|
||||
|
||||
t.Views().Commits().Focus()
|
||||
t.Views().Main().Content(MatchesRegexp("first line\n\\s*\n\\s*third line"))
|
||||
|
@ -17,22 +17,20 @@ var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
EmptyCommit("commit 3")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Model().CommitCount(3)
|
||||
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
SelectNextItem().
|
||||
Lines(
|
||||
Contains("commit 3"),
|
||||
Contains("commit 2").IsSelected(),
|
||||
Contains("commit 3").IsSelected(),
|
||||
Contains("commit 2"),
|
||||
Contains("commit 1"),
|
||||
).
|
||||
SelectNextItem().
|
||||
Press(keys.Universal.New).
|
||||
Tap(func() {
|
||||
branchName := "my-branch-name"
|
||||
t.ExpectPrompt().Title(Contains("New Branch Name")).Type(branchName).Confirm()
|
||||
|
||||
t.Model().CurrentBranchName(branchName)
|
||||
t.Git().CurrentBranchName(branchName)
|
||||
}).
|
||||
Lines(
|
||||
Contains("commit 2"),
|
||||
|
@ -16,8 +16,6 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
shell.Commit("first commit")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Model().CommitCount(1)
|
||||
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
|
@ -16,7 +16,8 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
CreateFile("myfile2", "myfile2 content")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Model().CommitCount(0)
|
||||
t.Views().Commits().
|
||||
IsEmpty()
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
@ -47,8 +48,11 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
commitMessage := "my commit message"
|
||||
t.ExpectCommitMessagePanel().Type(commitMessage).Confirm()
|
||||
|
||||
t.Model().CommitCount(1)
|
||||
t.Model().HeadCommitMessage(Equals(commitMessage))
|
||||
t.Views().Commits().
|
||||
Lines(
|
||||
Contains(commitMessage),
|
||||
)
|
||||
|
||||
t.Views().StagingSecondary().IsFocused()
|
||||
|
||||
// TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed)
|
||||
|
@ -16,7 +16,8 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
CreateFile("myfile2", "myfile2 content")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Model().CommitCount(0)
|
||||
t.Views().Commits().
|
||||
IsEmpty()
|
||||
|
||||
// stage the file
|
||||
t.Views().Files().
|
||||
@ -47,8 +48,11 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
commitMessage := ": my commit message"
|
||||
t.ExpectCommitMessagePanel().InitialText(Contains("WIP")).Type(commitMessage).Confirm()
|
||||
|
||||
t.Model().CommitCount(1)
|
||||
t.Model().HeadCommitMessage(Equals("WIP" + commitMessage))
|
||||
t.Views().Commits().
|
||||
Lines(
|
||||
Contains("WIP" + commitMessage),
|
||||
)
|
||||
|
||||
t.Views().StagingSecondary().IsFocused()
|
||||
|
||||
// TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed)
|
||||
|
@ -18,7 +18,8 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
CreateFile("myfile2", "myfile2 content")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Model().CommitCount(0)
|
||||
t.Views().Commits().
|
||||
IsEmpty()
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
@ -41,8 +42,11 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
commitMessage := "my commit message"
|
||||
t.ExpectCommitMessagePanel().Type(commitMessage).Confirm()
|
||||
|
||||
t.Model().CommitCount(1)
|
||||
t.Model().HeadCommitMessage(Equals(commitMessage))
|
||||
t.Views().Commits().
|
||||
Lines(
|
||||
Contains(commitMessage),
|
||||
)
|
||||
|
||||
t.Views().Staging().IsFocused()
|
||||
|
||||
// TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed)
|
||||
|
Reference in New Issue
Block a user