aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-03 12:24:58 -0500
committerCraig Jennings <c@cjennings.net>2026-06-03 12:24:58 -0500
commit459c257560b00a969cc4e8a15fe73377d6476683 (patch)
treeae68eff740ce7bc0682dcbbb8e096a459a064699 /tests
parent3c89a88e6f8a5ae75784568e866789804a7c0047 (diff)
downloadpearl-459c257560b00a969cc4e8a15fe73377d6476683.tar.gz
pearl-459c257560b00a969cc4e8a15fe73377d6476683.zip
feat(views): add pearl-assignee-tag-short to trim the @-tag to first name
The assignee @-tag slugs Linear's full @-mention handle, so a firstname.lastname handle still renders long (:@first_last:). For someone who wants a tighter tag line, I added pearl-assignee-tag-short (default off): when on, the tag keeps only the first segment of the handle (before the first dot or space), so :@first_last: becomes :@first: and a single-token handle like alice is unchanged. It's opt-in because first names collide across teammates, so the default stays the unambiguous full handle.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-pearl-labels.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test-pearl-labels.el b/tests/test-pearl-labels.el
index 94211b1..febb906 100644
--- a/tests/test-pearl-labels.el
+++ b/tests/test-pearl-labels.el
@@ -95,6 +95,20 @@ field -- which is the full email for teammates who never set a display name."
"With no displayName, the tag slugs the name."
(should (string= "@eric_bell" (pearl--assignee-tag '(:name "Eric Bell")))))
+(ert-deftest test-pearl-assignee-tag-short-keeps-first-segment ()
+ "With `pearl-assignee-tag-short' on, only the first name (before the first dot
+or space) is kept, so a firstname.lastname handle shortens to just the first."
+ (let ((pearl-assignee-tag-short t))
+ (should (string= "@vrezh" (pearl--assignee-tag '(:display-name "vrezh.mikayelyan"))))
+ (should (string= "@eric" (pearl--assignee-tag '(:name "Eric Bell"))))
+ ;; A single-token handle is unchanged.
+ (should (string= "@nerses" (pearl--assignee-tag '(:display-name "nerses"))))))
+
+(ert-deftest test-pearl-assignee-tag-short-off-keeps-full-handle ()
+ "Off by default: the full slugified handle is kept."
+ (should (string= "@vrezh_mikayelyan"
+ (pearl--assignee-tag '(:display-name "vrezh.mikayelyan")))))
+
(ert-deftest test-pearl-normalize-user-captures-display-name ()
"The normalized user carries Linear's displayName so the @-tag can use the
short handle while the drawer keeps the fuller name."