mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-12 11:15:00 +02:00
d7f84aed8a
Issue #1055 test: CopyPatchToClipboard (temporary commit for review)
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
package misc
|
|
|
|
import (
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
)
|
|
|
|
// We're emulating the clipboard by writing to a file called clipboard
|
|
|
|
var CopyToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
|
|
Description: "Copy a branch name to the clipboard using custom clipboard command template",
|
|
ExtraCmdArgs: []string{},
|
|
Skip: false,
|
|
SetupConfig: func(config *config.AppConfig) {
|
|
config.UserConfig.OS.CopyToClipboardCmd = "echo {{text}} > clipboard"
|
|
},
|
|
|
|
SetupRepo: func(shell *Shell) {
|
|
shell.NewBranch("branch-a")
|
|
},
|
|
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
|
t.Views().Branches().
|
|
Focus().
|
|
Lines(
|
|
Contains("branch-a").IsSelected(),
|
|
).
|
|
Press(keys.Universal.CopyToClipboard)
|
|
|
|
t.Views().Files().
|
|
Focus()
|
|
|
|
t.GlobalPress(keys.Files.RefreshFiles)
|
|
|
|
// Expect to see the clipboard file with contents
|
|
t.Views().Files().
|
|
IsFocused().
|
|
Lines(
|
|
Contains("clipboard").IsSelected(),
|
|
)
|
|
|
|
t.Views().Main().Content(Contains("branch-a"))
|
|
},
|
|
})
|