diff options
author | stk <stk@ableton.com> | 2023-02-07 13:33:10 +0100 |
---|---|---|
committer | stk <stk@ableton.com> | 2023-02-07 13:33:10 +0100 |
commit | e57843d947da03b6a187fc9a26acb276750224d0 (patch) | |
tree | 58cc33fb961364fdad8f363c10cfc1473e80fe32 /pkg/integration/tests/diff | |
parent | 5bb619821925cb653864f073587850a54fc2e6e1 (diff) |
Add integration test for ignoring whitespace in diff
Diffstat (limited to 'pkg/integration/tests/diff')
-rw-r--r-- | pkg/integration/tests/diff/ignore_whitespace.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/pkg/integration/tests/diff/ignore_whitespace.go b/pkg/integration/tests/diff/ignore_whitespace.go new file mode 100644 index 000000000..e4c01963f --- /dev/null +++ b/pkg/integration/tests/diff/ignore_whitespace.go @@ -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")) + }) + }, +}) |