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:
parent
5bb6198219
commit
e57843d947
33
pkg/integration/tests/diff/ignore_whitespace.go
Normal file
33
pkg/integration/tests/diff/ignore_whitespace.go
Normal 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"))
|
||||
})
|
||||
},
|
||||
})
|
@ -68,6 +68,7 @@ var tests = []*components.IntegrationTest{
|
||||
diff.Diff,
|
||||
diff.DiffAndApplyPatch,
|
||||
diff.DiffCommits,
|
||||
diff.IgnoreWhitespace,
|
||||
sync.FetchPrune,
|
||||
sync.RenameBranchAndPull,
|
||||
filter_by_path.CliArg,
|
||||
|
Loading…
x
Reference in New Issue
Block a user