From fe9b3cc768b7d2426eb5bcbc4a9ebf47ddf9886f Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 6 Nov 2026 18:24:07 +0100 Subject: [PATCH] Add a test for dragging commits past the edges of the commits view Dragging the first commit above the view, or the last commit below the end of the list, must not offer to drop them there, because that wouldn't move them anywhere. Co-Authored-By: Claude Opus 5.5 --- .../drag_to_reorder_past_the_edges.go | 52 +++++++++++++++++++ pkg/integration/tests/test_list.go | 1 + 2 files changed, 53 insertions(+) create mode 100644 pkg/integration/tests/interactive_rebase/drag_to_reorder_past_the_edges.go diff --git a/pkg/integration/tests/interactive_rebase/drag_to_reorder_past_the_edges.go b/pkg/integration/tests/interactive_rebase/drag_to_reorder_past_the_edges.go new file mode 100644 index 000000000..6aa8d6b6b --- /dev/null +++ b/pkg/integration/tests/interactive_rebase/drag_to_reorder_past_the_edges.go @@ -0,0 +1,52 @@ +package interactive_rebase + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var DragToReorderPastTheEdges = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Dragging the first commit above the view, or the last one below the list, doesn't move it", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.CreateNCommits(3) + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Commits(). + Focus(). + Lines( + Contains("commit-03").IsSelected(), + Contains("commit-02"), + Contains("commit-01"), + ). + ClickAndHold(1, 0). + MouseMove(1, -1). + Lines( + Contains("commit-03").IsSelected(), + Contains("commit-02"), + Contains("commit-01"), + ). + MouseRelease(). + Lines( + Contains("commit-03").IsSelected(), + Contains("commit-02"), + Contains("commit-01"), + ). + NavigateToLine(Contains("commit-01")). + ClickAndHold(1, 2). + MouseMove(1, 3). + Lines( + Contains("commit-03"), + Contains("commit-02"), + Contains("commit-01").IsSelected(), + ). + MouseRelease(). + Lines( + Contains("commit-03"), + Contains("commit-02"), + Contains("commit-01").IsSelected(), + ) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index 36c7475b1..9d49a1f96 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -368,6 +368,7 @@ var tests = []*components.IntegrationTest{ interactive_rebase.DragKeepsSelectionHighlighted, interactive_rebase.DragToReorder, interactive_rebase.DragToReorderInRebase, + interactive_rebase.DragToReorderPastTheEdges, interactive_rebase.DragToReorderWithAutoscroll, interactive_rebase.DropCommitInCopiedBranchWithUpdateRef, interactive_rebase.DropMergeCommit,