diff --git a/pkg/integration/tests/commit/stage_range_of_lines.go b/pkg/integration/tests/commit/stage_range_of_lines.go new file mode 100644 index 000000000..8c7b9c8a6 --- /dev/null +++ b/pkg/integration/tests/commit/stage_range_of_lines.go @@ -0,0 +1,42 @@ +package commit + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var StageRangeOfLines = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Staging a range of lines", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.CreateFileAndAdd("myfile", "1st\n2nd\n3rd\n4th\n5th\n6th\n") + shell.Commit("Add file") + shell.UpdateFile("myfile", "1st changed\n2nd changed\n3rd\n4th\n5th changed\n6th\n") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Files(). + IsFocused(). + PressEnter() + + t.Views().Staging(). + Content( + Contains("-1st\n-2nd\n+1st changed\n+2nd changed\n 3rd\n 4th\n-5th\n+5th changed\n 6th"), + ). + SelectedLine(Equals("-1st")). + Press(keys.Main.ToggleDragSelect). + SelectNextItem(). + SelectNextItem(). + SelectNextItem(). + SelectNextItem(). + PressPrimaryAction(). + Content( + Contains(" 3rd\n 4th\n-5th\n+5th changed\n 6th"), + ). + /* EXPECTED: + SelectedLine(Equals("-5th")) + ACTUAL */ + SelectedLine(Equals("+5th changed")) + }, +}) diff --git a/pkg/integration/tests/tests.go b/pkg/integration/tests/tests.go index 51d2a66df..955057649 100644 --- a/pkg/integration/tests/tests.go +++ b/pkg/integration/tests/tests.go @@ -52,6 +52,7 @@ var tests = []*components.IntegrationTest{ commit.Unstaged, commit.StagedWithoutHooks, commit.DiscardOldFileChange, + commit.StageRangeOfLines, custom_commands.Basic, custom_commands.FormPrompts, custom_commands.MenuFromCommand,