aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-26 19:28:05 -0500
committerCraig Jennings <c@cjennings.net>2026-05-26 19:28:05 -0500
commit00571a577e12e4a59b1400e9712e3423e4730643 (patch)
tree560f174d85367077f02cdd57d4f2e9cb448b85ed /tests
parent899c55f230d96649bdd3a3f4a8a0302ecf2df994 (diff)
downloadpearl-00571a577e12e4a59b1400e9712e3423e4730643.tar.gz
pearl-00571a577e12e4a59b1400e9712e3423e4730643.zip
feat(comments): fold the drawer and update the heading count on add
Adding a comment left three rough edges. Its property drawer rendered expanded while every other drawer in the page was folded, so I fold the new subtree's drawers right after inserting it. The Comments heading's count went stale on add: a freshly created subtree now shows 💬 Comments 1/1, and an existing 💬 Comments N/M bumps to N+1/M+1. And the fallback that creates the Comments subtree when an issue had none was still inserting a glyph-less "Comments". It now leads with the 💬 like the rest.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-integration-acceptance.el2
-rw-r--r--tests/test-pearl-comments.el15
2 files changed, 13 insertions, 4 deletions
diff --git a/tests/test-integration-acceptance.el b/tests/test-integration-acceptance.el
index 11b88b2..48dd70a 100644
--- a/tests/test-integration-acceptance.el
+++ b/tests/test-integration-acceptance.el
@@ -192,7 +192,7 @@ because the description-update mutation contains both `IssueDescription' and
(pearl-add-comment "looks good")
(should (memq 'comment-create test-integration--ops))
(goto-char (point-min))
- (should (re-search-forward "^\\*\\*\\* Comments$" nil t))
+ (should (re-search-forward "^\\*\\*\\* 💬 Comments 1/1$" nil t))
(should (re-search-forward "looks good" nil t))
;; --- edit the priority cookie, then save (reconcile-on-save) ---
(goto-char (point-min))
diff --git a/tests/test-pearl-comments.el b/tests/test-pearl-comments.el
index ae54f7d..99b705a 100644
--- a/tests/test-pearl-comments.el
+++ b/tests/test-pearl-comments.el
@@ -120,15 +120,24 @@
;;; --append-comment-to-issue
(ert-deftest test-pearl-append-comment-creates-subtree ()
- "Appending to an issue with no Comments subtree creates one."
+ "Appending to an issue with no Comments subtree creates one, glyphed and 1/1."
(test-pearl--in-org
"*** TODO [#B] Title\n:PROPERTIES:\n:LINEAR-ID: a\n:END:\nBody.\n"
(pearl--append-comment-to-issue
'(:id "c1" :author "A" :created-at "2026-05-23T09:00:00.000Z" :body "first comment"))
(goto-char (point-min))
- (should (re-search-forward "^\\*\\*\\* Comments$" nil t))
+ (should (re-search-forward "^\\*\\*\\* 💬 Comments 1/1$" nil t))
(should (re-search-forward "first comment" nil t))))
+(ert-deftest test-pearl-append-comment-bumps-count-marker ()
+ "Appending increments the shown/total count on an existing Comments heading."
+ (test-pearl--in-org
+ "** TODO [#B] Title\n:PROPERTIES:\n:LINEAR-ID: a\n:END:\nBody.\n*** 💬 Comments 1/1\n**** A — 2026-05-23T09:00:00.000Z\nfirst\n"
+ (pearl--append-comment-to-issue
+ '(:id "c2" :author "B" :created-at "2026-05-23T12:00:00.000Z" :body "second"))
+ (goto-char (point-min))
+ (should (re-search-forward "^\\*\\*\\* 💬 Comments 2/2$" nil t))))
+
(ert-deftest test-pearl-append-comment-newest-first-inserts-at-top ()
"With newest-first order, a new comment lands above the existing ones."
(let ((pearl-comment-sort-order 'newest-first))
@@ -169,7 +178,7 @@
(re-search-forward "Body.")
(pearl-add-comment "my new comment")
(goto-char (point-min))
- (should (re-search-forward "^\\*\\*\\* Comments$" nil t))
+ (should (re-search-forward "^\\*\\*\\* 💬 Comments 1/1$" nil t))
(should (re-search-forward "my new comment" nil t)))))
(ert-deftest test-pearl-add-comment-reports-failure ()