diff options
Diffstat (limited to 'tests/test-pearl-comment-editing.el')
| -rw-r--r-- | tests/test-pearl-comment-editing.el | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/test-pearl-comment-editing.el b/tests/test-pearl-comment-editing.el index b8b4af4..372cd95 100644 --- a/tests/test-pearl-comment-editing.el +++ b/tests/test-pearl-comment-editing.el @@ -247,15 +247,23 @@ "***** Them — 2026-05-24T10:00:00.000Z\n" ":PROPERTIES:\n:LINEAR-COMMENT-ID: c2\n:LINEAR-COMMENT-AUTHOR-ID: u-other\n:END:\ntheirs\n") (pearl--apply-comment-highlights "u-me") - (cl-flet ((face-on (pat) + (cl-flet ((face-at-text (pat) (goto-char (point-min)) - (re-search-forward pat) - (goto-char (line-beginning-position)) + (re-search-forward pat) ; point lands in the heading text (let ((ov (cl-find-if (lambda (o) (overlay-get o 'pearl-comment)) (overlays-at (point))))) - (and ov (overlay-get ov 'face))))) - (should (eq 'pearl-editable-comment (face-on "^\\*\\*\\*\\*\\* Me"))) - (should (eq 'pearl-readonly-comment (face-on "^\\*\\*\\*\\*\\* Them")))))) + (and ov (overlay-get ov 'face)))) + (overlay-on-stars-p (pat) + (goto-char (point-min)) + (re-search-forward pat) + (cl-find-if (lambda (o) (overlay-get o 'pearl-comment)) + (overlays-at (line-beginning-position))))) + (should (eq 'pearl-editable-comment (face-at-text "^\\*\\*\\*\\*\\* Me"))) + (should (eq 'pearl-readonly-comment (face-at-text "^\\*\\*\\*\\*\\* Them"))) + ;; the leading stars (and the bullet org-superstar composes from them) are + ;; left to org's own fontification — our overlay must not cover them + (should-not (overlay-on-stars-p "^\\*\\*\\*\\*\\* Me")) + (should-not (overlay-on-stars-p "^\\*\\*\\*\\*\\* 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 @@ -302,11 +310,13 @@ the refresh / add-comment / view-merge paths, never on the initial render." (save-excursion (goto-char (point-min)) (while (re-search-forward "^\\*+ " nil t) + ;; point is past the leading stars, in the heading text where + ;; the overlay now starts (let ((cid (org-entry-get nil "LINEAR-COMMENT-ID"))) (when cid (let ((ov (cl-find-if (lambda (o) (overlay-get o 'pearl-comment)) - (overlays-at (line-beginning-position))))) + (overlays-at (point))))) (push (cons cid (and ov (overlay-get ov 'face))) faces)))))) ;; both comment headings carry the editability overlay after a ;; plain bulk render — no refresh needed |
