aboutsummaryrefslogtreecommitdiff
path: root/tests/test-pearl-list-comments.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-24 17:21:29 -0500
committerCraig Jennings <c@cjennings.net>2026-05-24 17:21:29 -0500
commitcc599d3e9d37c200d49f723ff8e8ce694acd33f8 (patch)
tree6ee899bcd4a0a45c946329859d671ff6825efce7 /tests/test-pearl-list-comments.el
parentbb30b0f9146722b279832a991540917c3fa3cb81 (diff)
downloadpearl-cc599d3e9d37c200d49f723ff8e8ce694acd33f8.tar.gz
pearl-cc599d3e9d37c200d49f723ff8e8ce694acd33f8.zip
feat: make comment sort order configurable, newest-first by default
I added pearl-comment-sort-order to choose how an issue's comments render under the Comments heading: newest-first (the default, most recent on top) or oldest-first (chronological, like an email thread). Both the render sort and the add-comment insertion point honor it, so a new comment lands at the top for newest-first and at the bottom for oldest-first.
Diffstat (limited to 'tests/test-pearl-list-comments.el')
-rw-r--r--tests/test-pearl-list-comments.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/test-pearl-list-comments.el b/tests/test-pearl-list-comments.el
index 630c712..be0880e 100644
--- a/tests/test-pearl-list-comments.el
+++ b/tests/test-pearl-list-comments.el
@@ -98,13 +98,14 @@
;;; --format-comments with a marker
-(ert-deftest test-pearl-format-comments-renders-marker-and-oldest-first ()
- "With count-info, the Comments heading carries the marker; bodies stay oldest-first."
- (let* ((comments (test-pearl--comments 5)) ; newest-first as fetched
+(ert-deftest test-pearl-format-comments-renders-marker-and-order ()
+ "With count-info the Comments heading carries the marker; bodies honor the sort order."
+ (let* ((pearl-comment-sort-order 'newest-first)
+ (comments (test-pearl--comments 5)) ; newest-first as fetched
(out (pearl--format-comments comments '(:shown 5 :total 12 :overflow nil))))
(should (string-match-p "^\\*\\*\\* Comments 💬 5/12$" out))
- ;; oldest (comment 1) renders before newest (comment 5)
- (should (< (string-match "comment 1\\b" out) (string-match "comment 5\\b" out)))))
+ ;; newest (comment 5) renders before oldest (comment 1)
+ (should (< (string-match "comment 5\\b" out) (string-match "comment 1\\b" out)))))
(ert-deftest test-pearl-format-comments-no-marker-without-count ()
"Without count-info (the single-issue thread), the heading has no marker."