mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Add test demonstrating a bug with clicking in the staging view
When clicking in the main view to enter staging, and then pressing shift-down to select a range, it moves the selection rather than selecting a two-line range. We'll fix this in the next commit.
This commit is contained in:
parent
286e5f4849
commit
7655f6864e
1 changed files with 23 additions and 3 deletions
|
@ -50,7 +50,7 @@ var RangeSelect = NewIntegrationTest(NewIntegrationTestArgs{
|
|||
shell.CreateFile("file1", fileContent)
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
assertRangeSelectBehaviour := func(v *ViewDriver) {
|
||||
assertRangeSelectBehaviour := func(v *ViewDriver, otherView *ViewDriver, lineIdxOfFirstItem int) {
|
||||
v.
|
||||
SelectedLines(
|
||||
Contains("line 1"),
|
||||
|
@ -152,9 +152,29 @@ var RangeSelect = NewIntegrationTest(NewIntegrationTestArgs{
|
|||
SelectedLines(
|
||||
Contains("line 10"),
|
||||
)
|
||||
|
||||
// Click in view, press shift+arrow -> nonsticky range
|
||||
otherView.Focus()
|
||||
v.Click(1, lineIdxOfFirstItem).
|
||||
SelectedLines(
|
||||
Contains("line 1"),
|
||||
).
|
||||
Press(keys.Universal.RangeSelectDown)
|
||||
if lineIdxOfFirstItem == 6 {
|
||||
v.SelectedLines(
|
||||
// bug: it moved to line 2 instead of selecting both line 1 and line 2
|
||||
Contains("line 2"),
|
||||
)
|
||||
} else {
|
||||
// works correctly in list views though
|
||||
v.SelectedLines(
|
||||
Contains("line 1"),
|
||||
Contains("line 2"),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
assertRangeSelectBehaviour(t.Views().Commits().Focus())
|
||||
assertRangeSelectBehaviour(t.Views().Commits().Focus(), t.Views().Branches(), 0)
|
||||
|
||||
t.Views().Files().
|
||||
Focus().
|
||||
|
@ -163,6 +183,6 @@ var RangeSelect = NewIntegrationTest(NewIntegrationTestArgs{
|
|||
).
|
||||
PressEnter()
|
||||
|
||||
assertRangeSelectBehaviour(t.Views().Staging().IsFocused())
|
||||
assertRangeSelectBehaviour(t.Views().Staging().IsFocused(), t.Views().Files(), 6)
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue