-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix copying commit author to clipboard (#3936)
- **PR Description** This included single quotes in strange places in the copied text. Fixes #3933. - **Please check if the PR fulfills these requirements** * [x] Cheatsheets are up-to-date (run `go generate ./...`) * [x] Code has been formatted (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting)) * [x] Tests have been added/updated (see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md) for the integration test guide) * [ ] Text is internationalised (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation)) * [ ] If a new UserConfig entry was added, make sure it can be hot-reloaded (see [here](https://github.com/jesseduffield/lazygit/blob/master/docs/dev/Codebase_Guide.md#using-userconfig)) * [ ] Docs have been updated if necessary * [x] You've read through your own file changes for silly mistakes etc
- Loading branch information
Showing
3 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
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", "[email protected]") | ||
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(), | ||
) | ||
|
||
t.Views().Main().Content(Contains("/John Doe <[email protected]>/")) | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters