mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-05-22 10:15:43 +02: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:
@@ -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.PasteCommitMessage,
|
||||||
commit.PasteCommitMessageOverExisting,
|
commit.PasteCommitMessageOverExisting,
|
||||||
commit.PreserveCommitMessage,
|
commit.PreserveCommitMessage,
|
||||||
|
commit.PreserveCommitMessageWhitespace,
|
||||||
commit.ResetAuthor,
|
commit.ResetAuthor,
|
||||||
commit.ResetAuthorRange,
|
commit.ResetAuthorRange,
|
||||||
commit.Revert,
|
commit.Revert,
|
||||||
|
|||||||
Reference in New Issue
Block a user