summaryrefslogtreecommitdiffstats
path: root/pkg/integration
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-06-03 19:55:17 +1000
committerJesse Duffield <jessedduffield@gmail.com>2023-07-03 12:54:14 +1000
commitcd989d8ebeb923af74e8074cee09863b50862410 (patch)
treeb0a46e56462fbdee6e7e9cc4b3ac65595a810c0e /pkg/integration
parent261f30f49c552e3abe3bb7378208b0b355595c86 (diff)
Fix escape logic for remote branches
The remote branches controller was using its own escape method meaning it didn't go through the flow of cancelling an active filter. It's now using the same approach as the sub-commits and commit-files contexts: defining a parent context to return to upon hittin escape.
Diffstat (limited to 'pkg/integration')
-rw-r--r--pkg/integration/tests/filter_and_search/filter_remote_branches.go59
-rw-r--r--pkg/integration/tests/test_list.go1
2 files changed, 60 insertions, 0 deletions
diff --git a/pkg/integration/tests/filter_and_search/filter_remote_branches.go b/pkg/integration/tests/filter_and_search/filter_remote_branches.go
new file mode 100644
index 000000000..11cfea30b
--- /dev/null
+++ b/pkg/integration/tests/filter_and_search/filter_remote_branches.go
@@ -0,0 +1,59 @@
+package filter_and_search
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+var FilterRemoteBranches = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Filtering remote branches",
+ ExtraCmdArgs: []string{},
+ Skip: false,
+ SetupConfig: func(config *config.AppConfig) {},
+ SetupRepo: func(shell *Shell) {
+ shell.NewBranch("branch-apple")
+ shell.EmptyCommit("commit-one")
+ shell.NewBranch("branch-grape")
+ shell.NewBranch("branch-orange")
+
+ shell.CloneIntoRemote("origin")
+ },
+ Run: func(t *TestDriver, keys config.KeybindingConfig) {
+ t.Views().Remotes().
+ Focus().
+ Lines(
+ Contains(`origin`).IsSelected(),
+ ).
+ PressEnter()
+
+ t.Views().RemoteBranches().
+ IsFocused().
+ Lines(
+ Contains(`branch-apple`).IsSelected(),
+ Contains(`branch-grape`),
+ Contains(`branch-orange`),
+ ).
+ FilterOrSearch("grape").
+ Lines(
+ Contains(`branch-grape`).IsSelected(),
+ ).
+ // cancel the filter
+ PressEscape().
+ Tap(func() {
+ t.Views().Search().IsInvisible()
+ }).
+ Lines(
+ Contains(`branch-apple`),
+ Contains(`branch-grape`).IsSelected(),
+ Contains(`branch-orange`),
+ ).
+ // return to remotes view
+ PressEscape()
+
+ t.Views().Remotes().
+ IsFocused().
+ Lines(
+ Contains(`origin`).IsSelected(),
+ )
+ },
+})
diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go
index e3a6e51dd..9aab7ea43 100644
--- a/pkg/integration/tests/test_list.go
+++ b/pkg/integration/tests/test_list.go
@@ -98,6 +98,7 @@ var tests = []*components.IntegrationTest{
filter_and_search.FilterCommitFiles,
filter_and_search.FilterFiles,
filter_and_search.FilterMenu,
+ filter_and_search.FilterRemoteBranches,
filter_and_search.NestedFilter,
filter_and_search.NestedFilterTransient,
filter_by_path.CliArg,