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 | c6a81743f95638bc8275bea1b590f4ca9f7cbc39 (patch) | |
| tree | 074a8308eb30199abd30b0e0fac418e36ed11697 /tests/test-markdown-config.el | |
| parent | 810665a72ddb7721585e045113a82a8c218072e7 (diff) | |
| download | dotemacs-c6a81743f95638bc8275bea1b590f4ca9f7cbc39.tar.gz dotemacs-c6a81743f95638bc8275bea1b590f4ca9f7cbc39.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 62d199a8..45e1a601 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 |
