mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-08 22:36:49 +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:
@ -50,7 +50,7 @@ var RangeSelect = NewIntegrationTest(NewIntegrationTestArgs{
|
|||||||
shell.CreateFile("file1", fileContent)
|
shell.CreateFile("file1", fileContent)
|
||||||
},
|
},
|
||||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
assertRangeSelectBehaviour := func(v *ViewDriver) {
|
assertRangeSelectBehaviour := func(v *ViewDriver, otherView *ViewDriver, lineIdxOfFirstItem int) {
|
||||||
v.
|
v.
|
||||||
SelectedLines(
|
SelectedLines(
|
||||||
Contains("line 1"),
|
Contains("line 1"),
|
||||||
@ -152,9 +152,29 @@ var RangeSelect = NewIntegrationTest(NewIntegrationTestArgs{
|
|||||||
SelectedLines(
|
SelectedLines(
|
||||||
Contains("line 10"),
|
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().
|
t.Views().Files().
|
||||||
Focus().
|
Focus().
|
||||||
@ -163,6 +183,6 @@ var RangeSelect = NewIntegrationTest(NewIntegrationTestArgs{
|
|||||||
).
|
).
|
||||||
PressEnter()
|
PressEnter()
|
||||||
|
|
||||||
assertRangeSelectBehaviour(t.Views().Staging().IsFocused())
|
assertRangeSelectBehaviour(t.Views().Staging().IsFocused(), t.Views().Files(), 6)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user