mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 15:46:26 -04:00
Add integration test demonstrating whitespace loss in preserved commit messages
Typing a description with leading blank lines, canceling the commit panel, and reopening it currently drops leading blank lines.
This commit is contained in:
parent
4ab36461cb
commit
07a5bb5867
|
|
@ -0,0 +1,42 @@
|
|||
package commit
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var PreserveCommitMessageWhitespace = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Whitespace in the description (e.g. leading blank lines, indented first line) should be preserved when canceling and reopening the commit message panel",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateFileAndAdd("myfile", "myfile content")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
Press(keys.Files.CommitChanges)
|
||||
|
||||
t.ExpectPopup().CommitMessagePanel().
|
||||
Type("my commit message").
|
||||
SwitchToDescription().
|
||||
AddNewline().
|
||||
AddNewline().
|
||||
Type("body ").
|
||||
Cancel()
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
Press(keys.Files.CommitChanges)
|
||||
|
||||
t.ExpectPopup().CommitMessagePanel().
|
||||
Content(Equals("my commit message")).
|
||||
SwitchToDescription().
|
||||
/* EXPECTED:
|
||||
Content(Equals("\n\nbody ")).
|
||||
ACTUAL: */
|
||||
Content(Equals("body")).
|
||||
Cancel()
|
||||
},
|
||||
})
|
||||
|
|
@ -142,6 +142,7 @@ var tests = []*components.IntegrationTest{
|
|||
commit.PasteCommitMessage,
|
||||
commit.PasteCommitMessageOverExisting,
|
||||
commit.PreserveCommitMessage,
|
||||
commit.PreserveCommitMessageWhitespace,
|
||||
commit.ResetAuthor,
|
||||
commit.ResetAuthorRange,
|
||||
commit.Revert,
|
||||
|
|
|
|||
Loading…
Reference in a new issue