diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-24 00:06:01 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-24 00:06:01 -0400 |
| commit | f7af814cdfa3b7505dcf052be72f7a229cf9c5d6 (patch) | |
| tree | 26fd7abf33bea82a918c7ac2104d5e94f35ec5f5 /tests | |
| parent | 83f2ac011f1afb085745ea527990eea32019fc00 (diff) | |
| download | dotemacs-f7af814cdfa3b7505dcf052be72f7a229cf9c5d6.tar.gz dotemacs-f7af814cdfa3b7505dcf052be72f7a229cf9c5d6.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.el | 25 | ||||
| -rw-r--r-- | tests/test-init-module-headers.el | 1 |
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" |
