2022-10-15 04:57:19 +02:00
|
|
|
package stash
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
|
|
)
|
|
|
|
|
|
|
|
var Rename = NewIntegrationTest(NewIntegrationTestArgs{
|
|
|
|
Description: "Try to rename the stash.",
|
|
|
|
ExtraCmdArgs: "",
|
|
|
|
Skip: false,
|
|
|
|
SetupConfig: func(config *config.AppConfig) {},
|
|
|
|
SetupRepo: func(shell *Shell) {
|
|
|
|
shell.
|
|
|
|
EmptyCommit("blah").
|
2022-10-16 09:26:01 +02:00
|
|
|
CreateFileAndAdd("file-1", "change to stash1").
|
|
|
|
StashWithMessage("foo").
|
|
|
|
CreateFileAndAdd("file-2", "change to stash2").
|
2022-10-15 04:57:19 +02:00
|
|
|
StashWithMessage("bar")
|
|
|
|
},
|
|
|
|
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
|
|
|
input.SwitchToStashWindow()
|
|
|
|
assert.CurrentViewName("stash")
|
|
|
|
|
2022-12-24 08:01:26 +02:00
|
|
|
assert.SelectedLine(Equals("On master: bar"))
|
2022-10-16 09:26:01 +02:00
|
|
|
input.NextItem()
|
2022-12-24 08:01:26 +02:00
|
|
|
assert.SelectedLine(Equals("On master: foo"))
|
2022-10-15 04:57:19 +02:00
|
|
|
input.PressKeys(keys.Stash.RenameStash)
|
|
|
|
assert.InPrompt()
|
2022-12-24 08:01:26 +02:00
|
|
|
assert.CurrentViewTitle(Equals("Rename stash: stash@{1}"))
|
2022-10-15 04:57:19 +02:00
|
|
|
|
|
|
|
input.Type(" baz")
|
|
|
|
input.Confirm()
|
|
|
|
|
2022-12-24 08:01:26 +02:00
|
|
|
assert.SelectedLine(Equals("On master: foo baz"))
|
2022-10-15 04:57:19 +02:00
|
|
|
},
|
|
|
|
})
|