mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 12:55:47 +02:00
When cycling history, we want to make it so that upon returning to the original prompt, you get your text back. Importantly, we don't want to use the existing preservedMessage field for that because that's only for preserving a NEW commit message, and we don't want the history stuff of the commit reword flow to overwrite that.
59 lines
1.6 KiB
Go
59 lines
1.6 KiB
Go
package commit
|
|
|
|
import (
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
)
|
|
|
|
var HistoryComplex = NewIntegrationTest(NewIntegrationTestArgs{
|
|
Description: "More complex flow for cycling commit message history",
|
|
ExtraCmdArgs: "",
|
|
Skip: false,
|
|
SetupConfig: func(config *config.AppConfig) {},
|
|
SetupRepo: func(shell *Shell) {
|
|
shell.EmptyCommit("initial commit")
|
|
shell.EmptyCommit("commit 2")
|
|
shell.EmptyCommit("commit 3")
|
|
|
|
shell.CreateFileAndAdd("myfile", "myfile content")
|
|
},
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
|
// We're going to start a new commit message,
|
|
// then leave and try to reword a commit, then
|
|
// come back to original message and confirm we haven't lost our message.
|
|
// This shows that we're storing the preserved message for a new commit separately
|
|
// to the message when cycling history.
|
|
|
|
t.Views().Files().
|
|
IsFocused().
|
|
Press(keys.Files.CommitChanges)
|
|
|
|
t.ExpectPopup().CommitMessagePanel().
|
|
InitialText(Equals("")).
|
|
Type("my commit message").
|
|
Cancel()
|
|
|
|
t.Views().Commits().
|
|
Focus().
|
|
SelectedLine(Contains("commit 3")).
|
|
Press(keys.Commits.RenameCommit)
|
|
|
|
t.ExpectPopup().CommitMessagePanel().
|
|
InitialText(Equals("commit 3")).
|
|
SelectNextMessage().
|
|
Content(Equals("")).
|
|
Type("reworded message").
|
|
SelectPreviousMessage().
|
|
Content(Equals("commit 3")).
|
|
SelectNextMessage().
|
|
Content(Equals("reworded message")).
|
|
Cancel()
|
|
|
|
t.Views().Files().
|
|
Focus().
|
|
Press(keys.Files.CommitChanges)
|
|
|
|
t.ExpectPopup().CommitMessagePanel().
|
|
InitialText(Equals("my commit message"))
|
|
},
|
|
})
|