[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/webpaste 5c63d75 196/298: Added unit test for running hook
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/webpaste 5c63d75 196/298: Added unit test for running hooks on return |
Date: |
Thu, 9 Dec 2021 19:00:13 -0500 (EST) |
branch: elpa/webpaste
commit 5c63d75ab465ae8ba96ad16a8449e96334b3f18f
Author: Elis Axelsson <elis.axelsson@gmail.com>
Commit: Elis Axelsson <elis.axelsson@gmail.com>
Added unit test for running hooks on return
---
tests/unit/test-webpaste-return-url.el | 24 +++++++++++++++++++++++-
webpaste.el | 1 +
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/tests/unit/test-webpaste-return-url.el
b/tests/unit/test-webpaste-return-url.el
index 22056f4..85c1720 100644
--- a/tests/unit/test-webpaste-return-url.el
+++ b/tests/unit/test-webpaste-return-url.el
@@ -10,6 +10,7 @@
"Returning URLs to the user"
(before-each
+ (setq webpaste-return-url-hook nil)
(spy-on 'message)
(spy-on 'kill-new)
(spy-on 'browse-url-generic)
@@ -69,8 +70,29 @@
(expect 'message
:to-have-been-called-with
- "URL copied to clipboard."))))
+ "URL copied to clipboard.")))
+ (it
+ "can run user defined hooks"
+ (add-hook 'webpaste-return-url-hook 'message)
+ (add-hook 'webpaste-return-url-hook 'browse-url-generic)
+ (add-hook 'webpaste-return-url-hook 'simpleclip-set-contents)
+ (let ((webpaste-copy-to-clipboard nil)
+ (webpaste-add-to-killring nil)
+ (webpaste-open-in-browser nil))
+ (webpaste-return-url "https://example.com/")
+
+ (expect 'simpleclip-set-contents
+ :to-have-been-called-with
+ "https://example.com/")
+
+ (expect 'message
+ :to-have-been-called-with
+ "https://example.com/")
+
+ (expect 'browse-url-generic
+ :to-have-been-called-with
+ "https://example.com/"))))
;;; test-webpaste-return-url.el ends here
diff --git a/webpaste.el b/webpaste.el
index ae8fc8e..b7d49e4 100644
--- a/webpaste.el
+++ b/webpaste.el
@@ -79,6 +79,7 @@ This uses `simpleclip-set-contents' to copy to clipboard."
:group 'webpaste
:type 'boolean)
+
(defcustom webpaste-return-url-hook nil
"Hook executed with the returned url as parameter."
:group 'webpaste
- [nongnu] elpa/webpaste 1a6c0e9 263/298: Bump version number in file, (continued)
- [nongnu] elpa/webpaste 1a6c0e9 263/298: Bump version number in file, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 7a30602 274/298: Bump version number in file, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 84b5c80 279/298: readme: Add readme entry for max retries, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 533bb40 290/298: Apply suggestions from code review, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste dacb4fb 289/298: Add support for bpa.st pastebin, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 9ffa782 286/298: readme: Useful links in badges, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste a60d262 285/298: readme: Add status badges, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 65f664d 298/298: elpaignore: Add .elpaignore to ignore files in elpa builds, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 76d740e 283/298: travis: Drop travis, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 935eb5f 195/298: Remove :tangle yes from README, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 5c63d75 196/298: Added unit test for running hooks on return,
ELPA Syncer <=
- [nongnu] elpa/webpaste 6114da7 208/298: Refactor how integration tests are triggered, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 9d026d6 212/298: Remove emacs-24.3 from build target, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste cf2ea41 218/298: Update heading levels and add a TOC, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 7c3bc88 215/298: Remove unused local variable, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 9972cf4 224/298: Fix some checkdock warnings, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste b1cdedb 213/298: Simplify travis file, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste bd38635 253/298: [readme] Add two new suggestions for providers, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 01c2858 261/298: Fix typos, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste e7fed98 246/298: Reindent entire webpaste.el to match updated indentation style, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 9d3c866 233/298: WP-25: Implement support for raw pastes, ELPA Syncer, 2021/12/09