aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-26 15:57:11 -0500
committerCraig Jennings <c@cjennings.net>2026-05-26 15:57:11 -0500
commit5bb933761568982b0e60621577038450bc3dc2bf (patch)
tree0f96e867d6ac59ba969bbddb9449b2f159dae46d /tests
parent02d1c7b009f109a83a6c62ae56f4a3a9ba2d21e3 (diff)
downloadpearl-5bb933761568982b0e60621577038450bc3dc2bf.tar.gz
pearl-5bb933761568982b0e60621577038450bc3dc2bf.zip
feat(comments): dim read-only comments so they read as disabled
A comment you can't edit only had a grey heading, and the grey (`shadow`) was light enough to blend with the body text of your own comments. Now the read-only overlay covers the whole comment subtree, heading and body, so the comment recedes as a unit. And `pearl-readonly-comment` uses a darker background-aware grey (gray40 on a dark theme, gray60 on light, `shadow` as the fallback). Editable comments keep the heading-only overlay so your own comment text stays normal-colored, with the green heading as the "this one's yours" cue.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-pearl-comment-editing.el24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test-pearl-comment-editing.el b/tests/test-pearl-comment-editing.el
index 29a5236..b8b4af4 100644
--- a/tests/test-pearl-comment-editing.el
+++ b/tests/test-pearl-comment-editing.el
@@ -257,6 +257,30 @@
(should (eq 'pearl-editable-comment (face-on "^\\*\\*\\*\\*\\* Me")))
(should (eq 'pearl-readonly-comment (face-on "^\\*\\*\\*\\*\\* Them"))))))
+(ert-deftest test-pearl-highlight-readonly-comment-dims-its-body ()
+ "A read-only comment's body carries the grey overlay so the whole comment reads
+as disabled; an editable comment's body is left uncovered so its text reads
+normally (only its heading is colored)."
+ (test-pearl--in-org
+ (concat "*** TODO [#B] Title\n:PROPERTIES:\n:LINEAR-ID: a\n:END:\nBody.\n"
+ "**** Comments\n"
+ "***** Me — 2026-05-24T09:00:00.000Z\n"
+ ":PROPERTIES:\n:LINEAR-COMMENT-ID: c1\n:LINEAR-COMMENT-AUTHOR-ID: u-me\n:END:\nmine body\n"
+ "***** Them — 2026-05-24T10:00:00.000Z\n"
+ ":PROPERTIES:\n:LINEAR-COMMENT-ID: c2\n:LINEAR-COMMENT-AUTHOR-ID: u-other\n:END:\ntheirs body\n")
+ (pearl--apply-comment-highlights "u-me")
+ (cl-flet ((face-at (pat)
+ (goto-char (point-min))
+ (re-search-forward pat)
+ (goto-char (match-beginning 0))
+ (let ((ov (cl-find-if (lambda (o) (overlay-get o 'pearl-comment))
+ (overlays-at (point)))))
+ (and ov (overlay-get ov 'face)))))
+ ;; the other person's comment body is dimmed with the read-only face
+ (should (eq 'pearl-readonly-comment (face-at "theirs body")))
+ ;; my own comment body is left uncovered (its heading carries the green)
+ (should (null (face-at "mine body"))))))
+
(ert-deftest test-pearl-update-org-highlights-comments-on-bulk-render ()
"The bulk render colors comment headings, so a list-issues fetch shows
editability without a follow-up refresh. Regression: highlighting ran only on