-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use fuzzy search when filtering a view (#2808)
- Loading branch information
Showing
4 changed files
with
64 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package filter_and_search | ||
|
||
import ( | ||
"github.com/jesseduffield/lazygit/pkg/config" | ||
. "github.com/jesseduffield/lazygit/pkg/integration/components" | ||
) | ||
|
||
var FilterFuzzy = NewIntegrationTest(NewIntegrationTestArgs{ | ||
Description: "Verify that fuzzy filtering works (not just exact matches)", | ||
ExtraCmdArgs: []string{}, | ||
Skip: false, | ||
SetupConfig: func(config *config.AppConfig) {}, | ||
SetupRepo: func(shell *Shell) { | ||
shell.NewBranch("this-is-my-branch") | ||
shell.EmptyCommit("first commit") | ||
shell.NewBranch("other-branch") | ||
}, | ||
Run: func(t *TestDriver, keys config.KeybindingConfig) { | ||
t.Views().Branches(). | ||
Focus(). | ||
Lines( | ||
Contains(`other-branch`).IsSelected(), | ||
Contains(`this-is-my-branch`), | ||
). | ||
FilterOrSearch("timb"). // using first letters of words | ||
Lines( | ||
Contains(`this-is-my-branch`).IsSelected(), | ||
). | ||
FilterOrSearch("brnch"). // allows missing letter | ||
Lines( | ||
Contains(`other-branch`).IsSelected(), | ||
Contains(`this-is-my-branch`), | ||
) | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters