mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-03 13:21:56 +02:00
Add test demonstrating selection bug when staging a range of lines
The selected line is not in the right position after staging a range of lines; see next commit.
This commit is contained in:
parent
ff2a799200
commit
97daec7228
42
pkg/integration/tests/commit/stage_range_of_lines.go
Normal file
42
pkg/integration/tests/commit/stage_range_of_lines.go
Normal file
@ -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"))
|
||||
},
|
||||
})
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user