test-org/return: Add test clauses for `org-return' at citations

* testing/lisp/test-org.el (test-org/return): Add new tests checking
new functionality of `org-return' at citations and citation
references.
This commit is contained in:
Ihor Radchenko 2023-05-25 14:20:44 +02:00
parent 513534f2a7
commit aa3980dd7f
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 31 additions and 1 deletions

View File

@ -1646,7 +1646,37 @@ CLOCK: [2022-09-17 sam. 11:00]--[2022-09-17 sam. 11:46] => 0:46"
(setq-local fill-column 10)
(auto-fill-mode 1)
(org-return)
(buffer-string)))))
(buffer-string))))
;; When `org-return-follows-link' is non-nil, run `org-open-at-point'
;; on citation.
(should
(org-test-with-temp-text "[c<point>ite: @key1; @key2]"
(catch :called
(cl-letf (((symbol-function 'org-open-at-point)
(lambda (&rest _) (interactive) (throw :called t))))
(let ((org-return-follows-link t)) (org-return))
nil))))
(should-not
(org-test-with-temp-text "[c<point>ite: @key1; @key2]"
(catch :called
(cl-letf (((symbol-function 'org-open-at-point)
(lambda (&rest _) (interactive) (throw :called t))))
(let ((org-return-follows-link nil)) (org-return))
nil))))
(should
(org-test-with-temp-text "[cite: @k<point>ey1; @key2]"
(catch :called
(cl-letf (((symbol-function 'org-open-at-point)
(lambda (&rest _) (interactive) (throw :called t))))
(let ((org-return-follows-link t)) (org-return))
nil))))
(should-not
(org-test-with-temp-text "[cite: @k<point>ey1; @key2]"
(catch :called
(cl-letf (((symbol-function 'org-open-at-point)
(lambda (&rest _) (interactive) (throw :called t))))
(let ((org-return-follows-link nil)) (org-return))
nil)))))
(ert-deftest test-org/with-electric-indent ()
"Test RET and C-j specifications with `electric-indent-mode' on."