Add tests for headers and links

ご主人様
not manx 4 years ago
parent 3b63b2b910
commit a7d27114e3
Signed by: C-xC-c
GPG Key ID: F52ED472284EF2F4

@ -9,6 +9,11 @@
(should (string= expected-result (should (string= expected-result
(org-export-string-as org-source 'plumhtml t info))))) (org-export-string-as org-source 'plumhtml t info)))))
(defun regexp-render-as (expected-regexp org-source &optional info)
(let ((info (plist-put info :html-container nil)))
(should (string-match-p expected-regexp
(org-export-string-as org-source 'plumhtml t info)))))
;; Tables ;; Tables
(ert-deftest body () (ert-deftest body ()
(should-render-as (should-render-as
@ -44,3 +49,20 @@
(should-render-as (should-render-as
"<table><thead><tr><th>multi-line</th></tr>\n<tr><th>header</th></tr></thead>\n<tbody><tr><td>body</td></tr></tbody>\n</table>" "<table><thead><tr><th>multi-line</th></tr>\n<tr><th>header</th></tr></thead>\n<tbody><tr><td>body</td></tr></tbody>\n</table>"
"|multi-line|\n|header|\n|---|\n|body|")) "|multi-line|\n|header|\n|---|\n|body|"))
;; Headers and IDs
(ert-deftest header ()
(should-render-as
"<h1>mwee</h1>"
"* mwee"))
(ert-deftest header-export-ids ()
(regexp-render-as
"<h1 id=\"org[[:alnum:]]\\{7\\}\">mwee</h1>"
"* mwee" '(:export-header-ids t)))
;; Links and IDs
(ert-deftest link ()
(should-render-as
"<p><a href=\"https://example.com\">example</a></p>"
"[[https://example.com][example]]"))

Loading…
Cancel
Save