1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-03-03 15:02:52 +02:00

39 lines
779 B
Go
Raw Normal View History

2022-08-14 19:15:21 +10:00
package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
2022-08-14 20:13:39 +10:00
. "github.com/jesseduffield/lazygit/pkg/integration/components"
2022-08-14 19:15:21 +10:00
)
2022-08-14 20:13:39 +10:00
var Basic = NewIntegrationTest(NewIntegrationTestArgs{
2022-08-14 19:15:21 +10:00
Description: "Using a custom command to create a new file",
ExtraCmdArgs: "",
Skip: false,
2022-08-14 21:33:47 +10:00
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("blah")
},
2022-08-14 19:15:21 +10:00
SetupConfig: func(cfg *config.AppConfig) {
cfg.UserConfig.CustomCommands = []config.CustomCommand{
{
Key: "a",
Context: "files",
Command: "touch myfile",
},
}
},
Run: func(
2022-08-14 20:13:39 +10:00
shell *Shell,
2022-12-27 21:35:36 +11:00
t *TestDriver,
2022-08-14 19:15:21 +10:00
keys config.KeybindingConfig,
) {
2022-12-27 21:35:36 +11:00
t.Model().WorkingTreeFileCount(0)
2022-08-14 19:15:21 +10:00
2022-12-27 21:35:36 +11:00
t.Views().Files().
IsFocused().
Press("a").
Lines(
Contains("myfile"),
)
2022-08-14 19:15:21 +10:00
},
})