mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-06 22:33:07 +02:00
Add test demonstrating the problem
When filtering to show only tracked files, pressing `a` would also stage untracked files, which is confusing and undesired.
This commit is contained in:
@ -0,0 +1,57 @@
|
|||||||
|
package filter_and_search
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||||
|
)
|
||||||
|
|
||||||
|
var StageAllStagesOnlyTrackedFilesInTrackedOnlyFilter = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
|
Description: "Staging all files in tracked only view should stage only tracked files",
|
||||||
|
ExtraCmdArgs: []string{},
|
||||||
|
Skip: false,
|
||||||
|
SetupConfig: func(config *config.AppConfig) {
|
||||||
|
},
|
||||||
|
SetupRepo: func(shell *Shell) {
|
||||||
|
shell.CreateFileAndAdd("file-tracked", "foo")
|
||||||
|
|
||||||
|
shell.Commit("first commit")
|
||||||
|
|
||||||
|
shell.CreateFile("file-untracked", "bar")
|
||||||
|
shell.UpdateFile("file-tracked", "baz")
|
||||||
|
},
|
||||||
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
|
t.Views().Files().
|
||||||
|
Focus().
|
||||||
|
Lines(
|
||||||
|
Equals("▼ /").IsSelected(),
|
||||||
|
Equals(" M file-tracked"),
|
||||||
|
Equals(" ?? file-untracked"),
|
||||||
|
).
|
||||||
|
Press(keys.Files.OpenStatusFilter).
|
||||||
|
Tap(func() {
|
||||||
|
t.ExpectPopup().Menu().
|
||||||
|
Title(Equals("Filtering")).
|
||||||
|
Select(Contains("Show only tracked files")).
|
||||||
|
Confirm()
|
||||||
|
}).
|
||||||
|
Lines(
|
||||||
|
Equals(" M file-tracked"),
|
||||||
|
).
|
||||||
|
Press(keys.Files.ToggleStagedAll).
|
||||||
|
Press(keys.Files.OpenStatusFilter).
|
||||||
|
Tap(func() {
|
||||||
|
t.ExpectPopup().Menu().
|
||||||
|
Title(Equals("Filtering")).
|
||||||
|
Select(Contains("No filter")).
|
||||||
|
Confirm()
|
||||||
|
}).
|
||||||
|
Lines(
|
||||||
|
Equals("▼ /").IsSelected(),
|
||||||
|
Equals(" M file-tracked"), // 'M' is now in the left column, so file is staged
|
||||||
|
/* EXPECTED:
|
||||||
|
Equals(" ?? file-untracked"),
|
||||||
|
ACTUAL: */
|
||||||
|
Equals(" A file-untracked"),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
})
|
@ -229,6 +229,7 @@ var tests = []*components.IntegrationTest{
|
|||||||
filter_and_search.NestedFilter,
|
filter_and_search.NestedFilter,
|
||||||
filter_and_search.NestedFilterTransient,
|
filter_and_search.NestedFilterTransient,
|
||||||
filter_and_search.NewSearch,
|
filter_and_search.NewSearch,
|
||||||
|
filter_and_search.StageAllStagesOnlyTrackedFilesInTrackedOnlyFilter,
|
||||||
filter_and_search.StagingFolderStagesOnlyTrackedFilesInTrackedOnlyFilter,
|
filter_and_search.StagingFolderStagesOnlyTrackedFilesInTrackedOnlyFilter,
|
||||||
filter_by_author.SelectAuthor,
|
filter_by_author.SelectAuthor,
|
||||||
filter_by_author.TypeAuthor,
|
filter_by_author.TypeAuthor,
|
||||||
|
Reference in New Issue
Block a user