mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-06 13:00:59 -04:00
Add a test showing that a background refresh doesn't scroll to a conflict
If a rebase started outside of lazygit stops with a conflict, the next background refresh selects the conflicted commit. It keeps the scroll position though, so if there are enough pending todos above the conflicted commit, the selection is off-screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
cd23678775
commit
30744324f8
@@ -655,6 +655,7 @@ var tests = []*components.IntegrationTest{
|
||||
tag.ResetToDuplicateNamedBranch,
|
||||
ui.Accordion,
|
||||
ui.BackgroundRefreshKeepsScrollPosition,
|
||||
ui.BackgroundRefreshScrollsToConflictedCommit,
|
||||
ui.BranchesNotFirstTab,
|
||||
ui.CommitsNotFirstTab,
|
||||
ui.DisableSwitchTabWithPanelJumpKeys,
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var BackgroundRefreshScrollsToConflictedCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "A background refresh that selects a newly conflicted commit scrolls it into view",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
Width: 120,
|
||||
Height: 30,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("initial commit")
|
||||
shell.CreateFileAndAdd("file.txt", "master content")
|
||||
shell.Commit("master commit")
|
||||
shell.NewBranchFrom("branch", "master^")
|
||||
shell.CreateFileAndAdd("file.txt", "branch content")
|
||||
shell.Commit("this will conflict")
|
||||
shell.CreateNCommits(30)
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
SelectedLine(Contains("commit-30")).
|
||||
Tap(func() {
|
||||
t.Shell().RunCommandExpectError([]string{"git", "rebase", "master"})
|
||||
t.RefreshInBackground()
|
||||
}).
|
||||
// The conflicted commit, below the 30 pending todos and their header
|
||||
SelectedLineIdx(31).
|
||||
/* EXPECTED:
|
||||
SelectedLineIsVisible().
|
||||
SelectedLine(Contains("<-- CONFLICT --- this will conflict"))
|
||||
ACTUAL: */
|
||||
OriginY(0)
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user