diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-24 15:31:07 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-24 15:31:07 -0500 |
| commit | 02eee4ddb2f7e4cf4d12d8cdb879b0200e806a5a (patch) | |
| tree | d77876f11425a2411945728234a8b252c457fafc /tests/test-markdown-config.el | |
| parent | f11426433afc005cb4a5bce88afbb533d7444792 (diff) | |
| download | dotemacs-02eee4ddb2f7e4cf4d12d8cdb879b0200e806a5a.tar.gz dotemacs-02eee4ddb2f7e4cf4d12d8cdb879b0200e806a5a.zip | |
test: cover markdown-html filter and media-player selector
Two real-logic gaps from the refreshed coverage backlog. cj/markdown-html (markdown-config) is the impatient-mode filter that wraps a source buffer's text in the strapdown HTML shell — tested for normal content and an empty buffer. cj/select-media-player (media-utils) was the one untested function there — tested that choosing an available player updates cj/default-media-player and that a non-matching selection leaves it unchanged. Both mock at the boundary (completing-read, the source buffer).
Diffstat (limited to 'tests/test-markdown-config.el')
| -rw-r--r-- | tests/test-markdown-config.el | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test-markdown-config.el b/tests/test-markdown-config.el index 62d199a85..45e1a6018 100644 --- a/tests/test-markdown-config.el +++ b/tests/test-markdown-config.el @@ -23,5 +23,32 @@ `C-c '' opens those blocks in `markdown-mode'." (should (equal (cdr (assoc "markdown" org-src-lang-modes)) 'markdown))) +;;; cj/markdown-html (impatient-mode filter: source buffer -> HTML) + +(ert-deftest test-markdown-html-wraps-source-buffer-content () + "Normal: the source buffer's text is embedded in the strapdown HTML shell." + (let ((src (generate-new-buffer " *md-src*"))) + (unwind-protect + (progn + (with-current-buffer src (insert "# Title\n\nsome **markdown**")) + (with-temp-buffer + (cj/markdown-html src) + (let ((html (buffer-string))) + (should (string-match-p "<!DOCTYPE html>" html)) + (should (string-match-p "<xmp" html)) + (should (string-match-p "strapdown\\.js" html)) + (should (string-match-p "some \\*\\*markdown\\*\\*" html))))) + (kill-buffer src)))) + +(ert-deftest test-markdown-html-empty-source-buffer () + "Boundary: an empty source buffer still yields the HTML shell." + (let ((src (generate-new-buffer " *md-empty*"))) + (unwind-protect + (with-temp-buffer + (cj/markdown-html src) + (should (string-match-p "<!DOCTYPE html>" (buffer-string))) + (should (string-match-p "<xmp" (buffer-string)))) + (kill-buffer src)))) + (provide 'test-markdown-config) ;;; test-markdown-config.el ends here |
