mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-10-06 05:57:38 -04:00
Keep whole-file discard coverage on the surviving diff view
Removing the staging panel must not lose the handoff that happens when a file's final change disappears. Drive that behavior through the focused main view so the test continues to require focus and selection to follow the files panel onto the next diff. Co-Authored-By: GitHub Copilot <copilot@github.com>
This commit is contained in:
co-authored by
GitHub Copilot
parent
f4d7121ba2
commit
9bf4df77c6
+12
-15
@@ -1,4 +1,4 @@
|
||||
package staging
|
||||
package main_view
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
@@ -6,10 +6,12 @@ import (
|
||||
)
|
||||
|
||||
var DiscardAllChanges = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Discard all changes of a file in the staging panel, then assert we land in the staging panel of the next file",
|
||||
Description: "Discard all changes of a file from the focused main view, then land on the next file's diff",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupConfig: func(cfg *config.AppConfig) {
|
||||
cfg.GetUserConfig().Gui.UseHunkModeInStagingView = false
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateFileAndAdd("file1", "one\ntwo\n")
|
||||
shell.CreateFileAndAdd("file2", "1\n2\n")
|
||||
@@ -27,30 +29,25 @@ var DiscardAllChanges = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Equals(" M file2"),
|
||||
).
|
||||
SelectNextItem().
|
||||
PressEnter()
|
||||
Press(keys.Universal.FocusMainView)
|
||||
|
||||
t.Views().Staging().
|
||||
t.Views().Main().
|
||||
IsFocused().
|
||||
Press(keys.Main.ToggleSelectHunk).
|
||||
SelectedLines(Contains("+three")).
|
||||
// discard the line
|
||||
Press(keys.Universal.Remove).
|
||||
Tap(func() {
|
||||
t.Common().ConfirmDiscardLines()
|
||||
}).
|
||||
SelectedLines(Contains("+four")).
|
||||
// discard the other line
|
||||
Press(keys.Universal.Remove).
|
||||
Tap(func() {
|
||||
t.Common().ConfirmDiscardLines()
|
||||
})
|
||||
|
||||
// because there are no more changes in file1 we switch to file2
|
||||
t.Views().Files().
|
||||
Lines(
|
||||
Equals(" M file2"),
|
||||
)
|
||||
}).
|
||||
// assert we are still in the staging panel, but now looking at the changes of the other file
|
||||
t.Views().Files().Lines(
|
||||
Equals(" M file2"),
|
||||
)
|
||||
t.Views().Main().
|
||||
IsFocused().
|
||||
SelectedLines(Contains("+3"))
|
||||
},
|
||||
@@ -377,6 +377,7 @@ var tests = []*components.IntegrationTest{
|
||||
main_view.CopySelectedDiffLines,
|
||||
main_view.CustomPatchGoesThroughTheDiffRenderer,
|
||||
main_view.CustomPatchIgnoresLineEndingConversion,
|
||||
main_view.DiscardAllChanges,
|
||||
main_view.DiscardDiffLines,
|
||||
main_view.DiscardFromACommitOnlyWhereItCanBeRewritten,
|
||||
main_view.DiscardLinesFromACommit,
|
||||
@@ -516,7 +517,6 @@ var tests = []*components.IntegrationTest{
|
||||
shell_commands.History,
|
||||
shell_commands.OmitFromHistory,
|
||||
staging.DiffChangeScreenMode,
|
||||
staging.DiscardAllChanges,
|
||||
stash.Apply,
|
||||
stash.ApplyPatch,
|
||||
stash.CreateBranch,
|
||||
|
||||
Reference in New Issue
Block a user