1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

When refreshing models, re-apply active filter for the corresponding view

This commit is contained in:
Stefan Haller
2023-10-08 19:52:54 +02:00
parent ecaa4846f1
commit b5ca6a3add
7 changed files with 96 additions and 16 deletions

View File

@ -0,0 +1,52 @@
package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FilterUpdatesWhenModelChanges = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that after deleting a branch the filter is reapplied to show only the remaining branches",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("first commit")
shell.NewBranch("branch-to-delete")
shell.NewBranch("other")
shell.NewBranch("checked-out-branch")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("checked-out-branch").IsSelected(),
Contains("other"),
Contains("branch-to-delete"),
Contains("master"),
).
FilterOrSearch("branch").
Lines(
Contains("branch-to-delete").IsSelected(),
Contains("checked-out-branch"),
).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().
Menu().
Title(Equals("Delete branch 'branch-to-delete'?")).
Select(Contains("Delete local branch")).
Confirm()
}).
Lines(
Contains("checked-out-branch").IsSelected(),
).
// cancel the filter
PressEscape().
Lines(
Contains("checked-out-branch").IsSelected(),
Contains("other"),
Contains("master"),
)
},
})

View File

@ -133,6 +133,7 @@ var tests = []*components.IntegrationTest{
filter_and_search.FilterRemoteBranches,
filter_and_search.FilterRemotes,
filter_and_search.FilterSearchHistory,
filter_and_search.FilterUpdatesWhenModelChanges,
filter_and_search.NestedFilter,
filter_and_search.NestedFilterTransient,
filter_and_search.NewSearch,