summaryrefslogtreecommitdiff
path: root/bog-tests.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-12-13 22:21:31 -0500
committerKyle Meyer <kyle@kyleam.com>2014-12-13 22:21:31 -0500
commitecf7cb67ae95cbd5031ecea6600395453dda3621 (patch)
tree5542ae88ff670ead15575d541c309b52d8326749 /bog-tests.el
parent248f8a8e81dc161401dc50a3a84ebe41abb23f07 (diff)
downloadbog-ecf7cb67ae95cbd5031ecea6600395453dda3621.tar.gz
Extend goto functions to support citekey properties
bog-goto-citekey-heading-in-buffer gives preference to citekeys as heading titles over citekeys as properties. The order of preference for bog-goto-citekey-heading-in-notes is the citekey as a heading title in the current buffer, the citekey as a property in the current buffer, the citekey as heading title in notes, and, finally, the citekey as property in notes.
Diffstat (limited to 'bog-tests.el')
-rw-r--r--bog-tests.el28
1 files changed, 28 insertions, 0 deletions
diff --git a/bog-tests.el b/bog-tests.el
index 0532fc9..3fefc0b 100644
--- a/bog-tests.el
+++ b/bog-tests.el
@@ -328,6 +328,34 @@ other2000key <citekey>"
(bog-previous-non-heading-citekey 2)
(should (equal citekey (bog-citekey-at-point))))))
+;; `bog--find-citekey-heading-in-buffer'
+
+(ert-deftest bog--find-citekey-heading-in-buffer-citekey-heading ()
+ (let ((citekey "name2010word"))
+ (bog-tests--with-temp-text
+ "
+<point>
+* other heading
+
+* <citekey> "
+ (goto-char (bog--find-citekey-heading-in-buffer citekey))
+ (should (equal citekey (org-get-heading t t))))))
+
+(ert-deftest bog--find-citekey-heading-in-buffer-citekey-property ()
+ (let ((citekey "name2010word"))
+ (bog-tests--with-temp-text
+ (format "
+<point>
+* other heading
+
+* heading
+ :PROPERTIES:
+ :%s: <citekey>
+ :END"
+ bog-citekey-property)
+ (goto-char (bog--find-citekey-heading-in-buffer citekey))
+ (should (equal "heading" (org-get-heading t t))))))
+
;;; File functions