mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Add test for copying a commit author to the clipboard
The test shows that we are including single quotes in strange places.
This commit is contained in:
parent
a04ad24a60
commit
9b2a0c4538
2 changed files with 52 additions and 0 deletions
51
pkg/integration/tests/commit/copy_author_to_clipboard.go
Normal file
51
pkg/integration/tests/commit/copy_author_to_clipboard.go
Normal file
|
@ -0,0 +1,51 @@
|
|||
package commit
|
||||
|
||||
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 CopyAuthorToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Copy a commit author name to the clipboard",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
// Include delimiters around the text so that we can assert on the entire content
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "echo /{{text}}/ > clipboard"
|
||||
},
|
||||
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.SetAuthor("John Doe", "john@doe.com")
|
||||
shell.EmptyCommit("commit")
|
||||
},
|
||||
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("commit").IsSelected(),
|
||||
).
|
||||
Press(keys.Commits.CopyCommitAttributeToClipboard)
|
||||
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Copy to clipboard")).
|
||||
Select(Contains("Commit author")).
|
||||
Confirm()
|
||||
|
||||
t.ExpectToast(Equals("Commit author copied to clipboard"))
|
||||
|
||||
t.Views().Files().
|
||||
Focus().
|
||||
Press(keys.Files.RefreshFiles).
|
||||
Lines(
|
||||
Contains("clipboard").IsSelected(),
|
||||
)
|
||||
|
||||
/* EXPECTED:
|
||||
t.Views().Main().Content(Contains("/John Doe <john@doe.com>/"))
|
||||
ACTUAL: */
|
||||
t.Views().Main().Content(Contains("/'John Doe <john@doe.com'>/"))
|
||||
},
|
||||
})
|
|
@ -87,6 +87,7 @@ var tests = []*components.IntegrationTest{
|
|||
commit.CommitWithGlobalPrefix,
|
||||
commit.CommitWithNonMatchingBranchName,
|
||||
commit.CommitWithPrefix,
|
||||
commit.CopyAuthorToClipboard,
|
||||
commit.CreateAmendCommit,
|
||||
commit.CreateFixupCommitInBranchStack,
|
||||
commit.CreateTag,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue