1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-26 05:37:18 +02:00

66 lines
1.7 KiB
Go
Raw Normal View History

2023-02-12 09:53:57 +11:00
package submodule
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Add = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Add a submodule",
ExtraCmdArgs: []string{},
2023-02-12 09:53:57 +11:00
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("first commit")
2023-02-26 11:49:15 +11:00
shell.Clone("other_repo")
2023-02-12 09:53:57 +11:00
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Submodules().Focus().
Press(keys.Universal.New).
Tap(func() {
t.ExpectPopup().Prompt().
Title(Equals("New submodule URL:")).
2023-02-12 09:53:57 +11:00
Type("../other_repo").Confirm()
t.ExpectPopup().Prompt().
Title(Equals("New submodule name:")).
2023-02-12 09:53:57 +11:00
InitialText(Equals("other_repo")).
Clear().Type("my_submodule").Confirm()
t.ExpectPopup().Prompt().
Title(Equals("New submodule path:")).
2023-02-12 09:53:57 +11:00
InitialText(Equals("my_submodule")).
Clear().Type("my_submodule_path").Confirm()
}).
Lines(
Contains("my_submodule").IsSelected(),
)
t.Views().Main().TopLines(
Contains("Name: my_submodule"),
Contains("Path: my_submodule_path"),
Contains("Url: ../other_repo"),
)
t.Views().Files().Focus().
Lines(
Contains(".gitmodules").IsSelected(),
Contains("my_submodule_path (submodule)"),
).
Tap(func() {
t.Views().Main().Content(
Contains("[submodule \"my_submodule\"]").
Contains("path = my_submodule_path").
Contains("url = ../other_repo"),
)
}).
SelectNextItem().
Tap(func() {
t.Views().Main().Content(
Contains("Submodule my_submodule_path").
Contains("(new submodule)"),
)
})
},
})