60 lines
1.5 KiB
EmacsLisp
60 lines
1.5 KiB
EmacsLisp
(require 'ert)
|
|
(require 'ox-html)
|
|
(load-file "~/master-folder/org_files/org_roam/macros.el")
|
|
|
|
(defun helper/org-export-html (org-content)
|
|
"Export ORG-CONTENT string to HTML and return the result."
|
|
(with-temp-buffer
|
|
(insert org-content)
|
|
(org-mode)
|
|
(org-export-as 'html nil nil t)))
|
|
|
|
|
|
(ert-deftest test/org-macro-sidenote ()
|
|
(let ((html (helper/org-export-html
|
|
"Here is a sidenote {{{sidenote(This is a note)}}}."))
|
|
(expected "<span class=\"sidenote\">This is a note</span>")
|
|
)
|
|
(should
|
|
(string-match-p expected html))))
|
|
|
|
(ert-deftest test/org-macro-epigraph-single ()
|
|
(let ((html (helper/org-export-html
|
|
"{{{epigraph_single(To be is to do.,Socrates)}}}")))
|
|
(should
|
|
(string-match-p
|
|
"<blockquote class=\"epigraph\">"
|
|
html))
|
|
(should
|
|
(string-match-p
|
|
"<p>To be is to do\\.</p>"
|
|
html))
|
|
(should
|
|
(string-match-p
|
|
"<footer>Socrates</footer>"
|
|
html))))
|
|
|
|
(ert-deftest test/org-macro-epigraph-multiline ()
|
|
(let ((html (helper/org-export-html
|
|
"{{{epigraph(<p>Line one.</p><p>Line two.</p>)}}}")))
|
|
(should
|
|
(string-match-p
|
|
"<blockquote class=\"epigraph\">"
|
|
html))
|
|
(should
|
|
(string-match-p
|
|
"Line one\\."
|
|
html))
|
|
(should
|
|
(string-match-p
|
|
"Line two\\."
|
|
html))))
|
|
|
|
(ert-deftest test/org-macro-newthought ()
|
|
(let ((html (helper/org-export-html
|
|
"{{{newthought(Attention)}}} is important.")))
|
|
(should
|
|
(string-match-p
|
|
"<span class=\"newthought\">Attention</span>"
|
|
html))))
|