You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.7 KiB
47 lines
1.7 KiB
4 years ago
|
(require 'package)
|
||
|
(package-initialize)
|
||
|
|
||
|
(load-file "ox-plumhtml.el")
|
||
|
|
||
|
(defun should-render-as (expected-result org-source &optional info skip-newline)
|
||
|
(let ((expected-result (if skip-newline expected-result (concat expected-result "\n")))
|
||
|
(info (plist-put info :html-container nil)))
|
||
|
(should (string= expected-result
|
||
|
(org-export-string-as org-source 'plumhtml t info)))))
|
||
|
|
||
|
;; Tables
|
||
|
(ert-deftest body ()
|
||
|
(should-render-as
|
||
|
"<table><tbody><tr><td>body</td></tr></tbody>\n</table>"
|
||
|
"|body|"))
|
||
|
|
||
|
(ert-deftest multi-line-body ()
|
||
|
(should-render-as
|
||
|
"<table><tbody><tr><td>two</td></tr>\n<tr><td>lines</td></tr></tbody>\n</table>"
|
||
|
"|two|\n|lines|"))
|
||
|
|
||
|
(ert-deftest header-no-body ()
|
||
|
(should-render-as
|
||
|
"<table><tbody><tr><td>just a header</td></tr></tbody>\n</table>"
|
||
|
"|just a header|\n|---|"))
|
||
|
|
||
|
(ert-deftest header-and-body ()
|
||
|
(should-render-as
|
||
|
"<table><thead><tr><th>header</th></tr></thead>\n<tbody><tr><td>body</td></tr></tbody>\n</table>"
|
||
|
"|header|\n|---|\n|body|"))
|
||
|
|
||
|
(ert-deftest header-and-multi-line-body ()
|
||
|
(should-render-as
|
||
|
"<table><thead><tr><th>header</th></tr></thead>\n<tbody><tr><td>line 1</td></tr>\n<tr><td>line 2</td></tr>\n<tr><td>line 3</td></tr></tbody>\n</table>"
|
||
|
"|header|\n|---|\n|line 1|\n|line 2|\n|line 3|"))
|
||
|
|
||
|
(ert-deftest header-and-multiple-bodies ()
|
||
|
(should-render-as
|
||
|
"<table><thead><tr><th>header</th></tr></thead>\n<tbody><tr><td>two</td></tr></tbody>\n<tbody><tr><td>bodies</td></tr></tbody>\n</table>"
|
||
|
"|header|\n|---|\n|two|\n|---|\n|bodies|"))
|
||
|
|
||
|
(ert-deftest header-and-body ()
|
||
|
(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>"
|
||
|
"|multi-line|\n|header|\n|---|\n|body|"))
|