1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-25 12:24:47 +02:00

Add integration test for ignoring whitespace in diff

This commit is contained in:
stk 2023-02-07 13:33:10 +01:00
parent 5bb6198219
commit e57843d947
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,33 @@
package diff
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var IgnoreWhitespace = NewIntegrationTest(NewIntegrationTestArgs{
Description: "View diff with and without ignoring whitespace",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file1", "first line\nsecond line\n")
shell.Commit("first commit")
// First line has a real change, second line changes only indentation:
shell.UpdateFileAndAdd("file1", "first line changed\n second line\n")
shell.Commit("second commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Tap(func() {
// By default, both changes are shown in the diff:
t.Views().Main().Content(Contains("-first line\n-second line\n+first line changed\n+ second line\n"))
}).
Press(keys.Universal.ToggleWhitespaceInDiffView).
Tap(func() {
// After enabling ignore whitespace, only the real change remains:
t.Views().Main().Content(Contains("-first line\n+first line changed\n"))
})
},
})

View File

@ -68,6 +68,7 @@ var tests = []*components.IntegrationTest{
diff.Diff,
diff.DiffAndApplyPatch,
diff.DiffCommits,
diff.IgnoreWhitespace,
sync.FetchPrune,
sync.RenameBranchAndPull,
filter_by_path.CliArg,