aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-24 00:06:01 -0400
committerCraig Jennings <c@cjennings.net>2026-06-24 00:06:01 -0400
commite15161ecba0783f2c21413996e6801e4ec57d2d2 (patch)
tree9b2ac64db8b9a93d4fb80bb2a69703ce159d5615 /tests
parente0fed0922011e2944c339709f6bb49c6572629ab (diff)
downloaddotemacs-e15161ecba0783f2c21413996e6801e4ec57d2d2.tar.gz
dotemacs-e15161ecba0783f2c21413996e6801e4ec57d2d2.zip
feat(face-diagnostic): make report face names describe-face buttons
Render each real face name in the Face Diagnosis report as a button that runs describe-face on it, carrying the face as button data; anonymous specs and non-faces stay plain text. Also add face-diagnostic to the module-header allowlist now that it is required in init.el and carries the header contract. Claude-Session: https://claude.ai/code/session_01BqrdWUo9GcznYX2pZr76gZ
Diffstat (limited to 'tests')
-rw-r--r--tests/test-face-diagnostic.el25
-rw-r--r--tests/test-init-module-headers.el1
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/test-face-diagnostic.el b/tests/test-face-diagnostic.el
index 241425fc5..32595b464 100644
--- a/tests/test-face-diagnostic.el
+++ b/tests/test-face-diagnostic.el
@@ -286,6 +286,31 @@
(should (string-match-p "Real font" report))
(should (string-match-p "Provenance" report)))))
+(ert-deftest test-face-diag-face-button-real-face-is-button ()
+ "Normal: a real face renders as a `describe-face' button carrying the face.
+Visible label is unchanged; the button data is the face so RET/mouse opens it."
+ (let ((s (cj/--face-diag-face-button 'bold)))
+ (should (equal (substring-no-properties s) "bold"))
+ (should (get-text-property 0 'button s))
+ (should (eq (get-text-property 0 'button-data s) 'bold))))
+
+(ert-deftest test-face-diag-face-button-non-face-is-plain ()
+ "Boundary: a symbol that is not a face stays plain text, no button."
+ (let ((s (cj/--face-diag-face-button 'cj-not-a-real-face-xyz)))
+ (should (equal s "cj-not-a-real-face-xyz"))
+ (should-not (get-text-property 0 'button s))))
+
+(ert-deftest test-face-diag-face-button-anonymous-spec-is-plain ()
+ "Error: an anonymous (:attr val ...) spec is not a face, so no button."
+ (let ((s (cj/--face-diag-face-button '(:foreground "red"))))
+ (should-not (get-text-property 0 'button s))))
+
+(ert-deftest test-face-diag-render-faces-buttonizes-real-face ()
+ "Normal: a real face in the stack render carries a button property."
+ (let ((s (cj/--face-diag-render-faces '(bold))))
+ (should (string-match-p "bold" s))
+ (should (get-text-property 0 'button s))))
+
(ert-deftest test-face-diag-render-banner-out-of-scope ()
"Boundary: a terminal classification renders a banner naming the ANSI source."
(should (string-match-p "terminal" (cj/--face-diag-render-banner 'terminal-ansi)))
diff --git a/tests/test-init-module-headers.el b/tests/test-init-module-headers.el
index 4b6ac05c4..478819b89 100644
--- a/tests/test-init-module-headers.el
+++ b/tests/test-init-module-headers.el
@@ -105,6 +105,7 @@
"erc-config"
"eshell-config"
"eww-config"
+ "face-diagnostic"
"flyspell-and-abbrev"
"games-config"
"gloss-config"