mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-01 08:28:06 -06:00
Add a test for staging a line with diff.mnemonicPrefix set
If diff.mnemonicPrefix is set, pressing space on a line in the focused main view does nothing. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e67a85a075
commit
c0d4be6b66
2 files changed
+52
No files matched your search
@@ -0,0 +1,51 @@
|
||||
package main_view
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var StageDiffLinesWithMnemonicPrefixes = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Stage a line from the focused main view when diff.mnemonicPrefix is set",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(cfg *config.AppConfig) {
|
||||
cfg.GetUserConfig().Gui.UseHunkModeInDiffView = false
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateFileAndAdd("file1", "one\ntwo\nthree\n")
|
||||
shell.Commit("one")
|
||||
|
||||
shell.UpdateFile("file1", "one\nADD1\nADD2\ntwo\nthree\n")
|
||||
|
||||
// git then puts i/ and w/ in front of the paths of the working tree's diff
|
||||
// instead of a/ and b/.
|
||||
shell.SetConfig("diff.mnemonicPrefix", "true")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("file1").IsSelected(),
|
||||
).
|
||||
Press(keys.Universal.FocusMainView)
|
||||
|
||||
// The user chose these prefixes, so the diff shows them.
|
||||
t.Views().Main().
|
||||
IsFocused().
|
||||
ContainsLines(
|
||||
Equals("diff --git i/file1 w/file1"),
|
||||
).
|
||||
SelectedLines(
|
||||
Contains("+ADD1"),
|
||||
).
|
||||
PressPrimaryAction()
|
||||
|
||||
t.Views().Files().Lines(
|
||||
/* EXPECTED:
|
||||
Contains("MM file1"),
|
||||
ACTUAL: */
|
||||
Contains(" M file1"),
|
||||
)
|
||||
},
|
||||
})
|
||||
@@ -489,6 +489,7 @@ var tests = []*components.IntegrationTest{
|
||||
main_view.StageDiffLines,
|
||||
main_view.StageDiffLinesOfAPathWithASpace,
|
||||
main_view.StageDiffLinesWithCustomPrefixes,
|
||||
main_view.StageDiffLinesWithMnemonicPrefixes,
|
||||
main_view.StageDiffLinesWithNoPrefixes,
|
||||
main_view.StageHunksWithRapidKeypresses,
|
||||
main_view.StagePartialBlockOfChangesFirstLines,
|
||||
|
||||
Reference in new issue
Block a user