1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-29 22:48:24 +02:00

Collapse/expand all files in tree

Co-authored-by: Stefan Haller <stefan@haller-berlin.de>
This commit is contained in:
Mauricio Trajano
2024-12-26 23:34:08 -05:00
committed by Stefan Haller
parent 14a91d9829
commit 7bea41534b
21 changed files with 276 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
package file
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CollapseExpand = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Collapsing and expanding all files in the file tree",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
shell.CreateDir("dir")
shell.CreateFile("dir/file-one", "original content\n")
shell.CreateDir("dir2")
shell.CreateFile("dir2/file-two", "original content\n")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Contains("dir").IsSelected(),
Contains("??").Contains("file-one"),
Contains("dir2"),
Contains("??").Contains("file-two"),
)
t.Views().Files().
Press(keys.Files.CollapseAll).
Lines(
Contains("dir"),
Contains("dir2"),
)
t.Views().Files().
Press(keys.Files.ExpandAll).
Lines(
Contains("dir").IsSelected(),
Contains("??").Contains("file-one"),
Contains("dir2"),
Contains("??").Contains("file-two"),
)
},
})