emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/hyperbole c122d2e 2/2: Merge branch 'master' of hyperbo


From: ELPA Syncer
Subject: [elpa] externals/hyperbole c122d2e 2/2: Merge branch 'master' of hyperbole
Date: Tue, 4 May 2021 01:57:13 -0400 (EDT)

branch: externals/hyperbole
commit c122d2e73c4f26426a5cc8e15e649c4602045ea2
Merge: 3def338 bda4f5e
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>

    Merge branch 'master' of hyperbole
---
 ChangeLog               | 12 ++++++
 test/smart-org-tests.el | 97 +++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 97 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5c737c5..fe2e2a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,18 @@
 
 2021-05-02  Mats Lidell  <matsl@gnu.org>
 
+* test/hib-org-tests.el
+    (hib-org:org-mode-with-no-smart-keys-on-file-is-org-meta-return)
+    (hib-org:org-mode-with-no-smart-keys-on-hypb-button-is-org-meta-return)
+    (hib-org:org-mode-with-no-smart-keys-on-org-link-is-org-meta-return)
+    (hib-org:org-mode-with-smart-keys-buttons-on-file-is-org-meta-return)
+    (hib-org:org-mode-with-smart-keys-buttons-on-hypb-button-activates)
+    (hib-org:org-mode-with-smart-keys-buttons-on-org-link-is-org-meta-return)
+    (hib-org:org-mode-with-smart-keys-on-file-activates)
+    (hib-org:org-mode-with-smart-keys-on-hypb-button-activates)
+    (hib-org:org-mode-with-smart-keys-on-org-link-activates):
+    Update and add new tests for hsys-org-enable-smart-keys.
+
 * hui-em-but.el (hbut-face): Add face for hbuts.
     (hproperty:but-face): Use face for property.
     (hbut-item-face): Add face for hbut items.
diff --git a/test/smart-org-tests.el b/test/smart-org-tests.el
index 0d7435d..71d488f 100644
--- a/test/smart-org-tests.el
+++ b/test/smart-org-tests.el
@@ -20,6 +20,7 @@
 (require 'ert)
 (require 'hui-mouse)
 (require 'hact)
+(require 'el-mock)
 
 (declare-function hy-test-helpers:hypb-function-should-call-hpath:find 
"hy-test-helpers")
 
@@ -40,8 +41,20 @@
       (next-line)
       (should (equal (line-number-at-pos) 4)))))
 
-(ert-deftest smart-org-mode-with-smart-keys-on-file-is-hypb-button ()
-  "With smart keys on file name is hypb button."
+;; Smart Key Context
+(ert-deftest smart-org-mode-with-smart-keys-on-delimited-thing-activates ()
+  "With smart keys on delimited thing activates selection."
+  (with-temp-buffer
+    (let ((hsys-org-enable-smart-keys t))
+      (org-mode)
+      (insert "(hy per bo le)\n")
+      (goto-char 14)
+      (action-key)
+      (should (equal (point) 1)))))
+
+;; Hyperbole Button
+(ert-deftest smart-org-mode-with-smart-keys-on-hypb-button-activates ()
+  "With smart keys on hypb button activates."
   (with-temp-buffer
     (let ((hsys-org-enable-smart-keys t))
       (org-mode)
@@ -49,28 +62,88 @@
       (goto-char 1)
       (hy-test-helpers:hypb-function-should-call-hpath:find 'smart-org 
"/tmp"))))
 
-(ert-deftest smart-org-mode-with-smart-keys-buttons-on-file-is-hypb-button ()
-  "With smart keys on file name is hypb button."
+;; Org Link
+(ert-deftest smart-org-mode-with-smart-keys-on-org-link-activates ()
+  "With smart keys on `org-mode' link activates link."
+  (with-temp-buffer
+    (let ((hsys-org-enable-smart-keys t))
+      (org-mode)
+      (insert "[[/tmp][desc]]")
+      (goto-char 9)
+      (with-mock
+       (mock (org-open-at-point) => t)
+       (smart-org)))))
+
+;; Smart Key Context
+(ert-deftest 
smart-org-mode-with-smart-keys-buttons-on-delimited-thing-calls-org-meta-return 
()
+  "With smart keys as buttons on delimited falls back to `org-meta-return'."
+  (with-temp-buffer
+    (let ((hsys-org-enable-smart-keys 'buttons))
+      (org-mode)
+      (insert "(hy per bo le)\n")
+      (goto-char 14)
+      (with-mock
+       (mock (org-meta-return nil) => t)
+       (smart-org)))))
+
+;; Hyperbole Button
+(ert-deftest smart-org-mode-with-smart-keys-buttons-on-hypb-button-activates ()
+  "With smart keys as buttons on hypb button activates."
   (with-temp-buffer
     (let ((hsys-org-enable-smart-keys 'buttons))
       (org-mode)
       (insert "/tmp")
       (goto-char 1)
-      (hy-test-helpers:hypb-function-should-call-hpath:find 'smart-org 
"/tmp"))))
+      (hy-test-helpers:hypb-function-should-call-hpath:find 'action-key 
"/tmp"))))
 
-(ert-deftest smart-org-mode-with-no-smart-keys-on-file-is-hypb-button ()
-  "With no smart keys on file calls org mode M-RET."
+;; Org Link
+(ert-deftest 
smart-org-mode-with-smart-keys-buttons-on-org-link-calls-org-meta-return ()
+  "With smart keys as buttons on `org-mode' link activates link."
+  (with-temp-buffer
+    (let ((hsys-org-enable-smart-keys 'buttons))
+      (org-mode)
+      (insert "[[/tmp][desc]]")
+      (goto-char 9)
+      (with-mock
+       (mock (org-open-at-point) => t)
+       (smart-org)))))
+
+;; Smart Key Context
+(ert-deftest 
smart-org-mode-with-no-smart-keys-on-delimited-thing-calls-org-meta-return ()
+  "With no smart keys on file calls `org-meta-return'."
   (with-temp-buffer
     (let ((bn (buffer-name))
           (hsys-org-enable-smart-keys nil))
       (org-mode)
-      (insert "/tmp")
-      (goto-char 1)
+      (insert "(hy per bo le)\n")
+      (goto-char 14)
       (smart-org)
-      ;; Setting the buffer should not be needed but for some reason
-      ;; it looks like we get into ert buffer after smart-org
       (set-buffer bn)
-      (should (equal (buffer-string) "* /tmp")))))
+      (should (string= (buffer-string) "(hy per bo le\n* )\n")))))
+
+;; Hyperbole Button
+(ert-deftest 
smart-org-mode-with-no-smart-keys-on-hypb-button-calls-org-meta-return ()
+  "With no smart keys on file calls `org-meta-return'."
+  (with-temp-buffer
+    (let ((hsys-org-enable-smart-keys nil))
+      (org-mode)
+      (insert "/tmp")
+      (goto-char 1)
+      (with-mock
+       (mock (org-meta-return nil) => t)
+       (smart-org)))))
+
+;; Org Link
+(ert-deftest smart-org-mode-with-no-smart-keys-on-org-link-is-org-meta-return 
()
+  "With no smart keys on `org-mode' link calls `org-meta-return'."
+  (with-temp-buffer
+    (let ((hsys-org-enable-smart-keys nil))
+      (org-mode)
+      (insert "[[/tmp][desc]]")
+      (goto-char 9)
+      (with-mock
+       (mock (org-meta-return nil) => t)
+       (smart-org)))))
 
 (provide 'smart-org-tests)
 ;;; smart-org-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]