aboutsummaryrefslogtreecommitdiff
path: root/tests/test-org-webclipper-commands.el
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-org-webclipper-commands.el')
-rw-r--r--tests/test-org-webclipper-commands.el16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/test-org-webclipper-commands.el b/tests/test-org-webclipper-commands.el
index 3871774c..57c7b5fc 100644
--- a/tests/test-org-webclipper-commands.el
+++ b/tests/test-org-webclipper-commands.el
@@ -29,19 +29,27 @@
;;; cj/webclipper-ensure-initialized
-(ert-deftest test-webclipper-ensure-initialized-registers-protocol-and-templates ()
- "Normal: first call sets up the protocol entry + W and w capture templates,
-and flips the initialized flag."
+(ert-deftest test-webclipper-ensure-initialized-registers-templates ()
+ "Normal: first call sets up the W and w capture templates and flips the
+initialized flag. Protocol registration lives in the
+`with-eval-after-load 'org-protocol' block at the bottom of the module --
+asserted separately below in `test-webclipper-protocol-registered-via-after-load'."
(let ((cj/webclipper-initialized nil)
(org-protocol-protocol-alist nil)
(org-capture-templates nil))
(cl-letf (((symbol-function 'require) (lambda (&rest _) t)))
(cj/webclipper-ensure-initialized))
(should cj/webclipper-initialized)
- (should (assoc "webclip" org-protocol-protocol-alist))
(should (assoc "W" org-capture-templates))
(should (assoc "w" org-capture-templates))))
+(ert-deftest test-webclipper-protocol-registered-via-after-load ()
+ "Loading org-webclipper installs a `with-eval-after-load 'org-protocol' block
+that registers the webclip entry. Providing `'org-protocol' fires the block."
+ (let ((org-protocol-protocol-alist nil))
+ (provide 'org-protocol)
+ (should (assoc "webclip" org-protocol-protocol-alist))))
+
(ert-deftest test-webclipper-ensure-initialized-is-idempotent ()
"Boundary: second call doesn't re-register or duplicate templates."
(let ((cj/webclipper-initialized nil)