aboutsummaryrefslogtreecommitdiff
path: root/tests/test-wttrin--mode-line-update-display.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-23 23:04:46 -0400
committerCraig Jennings <c@cjennings.net>2026-06-23 23:04:46 -0400
commit4d46eafaa087f5570ece9d2e5f5d2ba6bc0d824e (patch)
tree19c24dc27a1f72e8b05a98b43a429c49f917fc4a /tests/test-wttrin--mode-line-update-display.el
parenteaabae3b01b8bdc05a5892492c06a8131c195a45 (diff)
downloademacs-wttrin-4d46eafaa087f5570ece9d2e5f5d2ba6bc0d824e.tar.gz
emacs-wttrin-4d46eafaa087f5570ece9d2e5f5d2ba6bc0d824e.zip
feat: expose themeable faces for mode-line and buffer text
I added four customizable faces so themes and customize-face can restyle the text wttrin draws itself: wttrin-mode-line-stale (the dimmed stale mode-line emoji), wttrin-staleness-header (the "Last updated:" line), wttrin-instructions (the footer prose), and wttrin-key (the [a]/[g]/[q] chords). The package exposed no faces before and hardcoded one color. The stale-emoji dimming used a literal "gray60". Now it inherits a face, so the color tracks the theme. I changed make-emoji-icon's second argument from a color string to a face symbol applied via :inherit. wttrin-key inherits bold rather than help-key-binding, which is Emacs 28+ while the package supports 24.4. The weather ASCII art stays colored by xterm-color's ANSI faces. Only the package's own text is newly faced.
Diffstat (limited to 'tests/test-wttrin--mode-line-update-display.el')
-rw-r--r--tests/test-wttrin--mode-line-update-display.el10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/test-wttrin--mode-line-update-display.el b/tests/test-wttrin--mode-line-update-display.el
index 0635b5f..721517e 100644
--- a/tests/test-wttrin--mode-line-update-display.el
+++ b/tests/test-wttrin--mode-line-update-display.el
@@ -170,7 +170,7 @@
(test-wttrin--mode-line-update-display-teardown)))
(ert-deftest test-wttrin--mode-line-update-display-stale-emoji-dimmed ()
- "Stale data dims the emoji with gray foreground."
+ "Stale data dims the emoji via the `wttrin-mode-line-stale' face."
(test-wttrin--mode-line-update-display-setup)
(unwind-protect
(let ((wttrin-mode-line-refresh-interval 900)
@@ -178,13 +178,13 @@
(cl-letf (((symbol-function 'float-time) (lambda () 3000.0)))
(setq wttrin--mode-line-cache (cons 1000.0 "Paris: X +61°F Clear"))
(wttrin--mode-line-update-display)
- ;; The emoji character should have a gray face
+ ;; The emoji character should inherit the stale face
(let* ((str wttrin-mode-line-string)
;; Find the emoji position (after the space)
(emoji-pos 1)
(face (get-text-property emoji-pos 'face str)))
(should face)
- (should (equal (plist-get face :foreground) "gray60")))))
+ (should (eq (plist-get face :inherit) 'wttrin-mode-line-stale)))))
(test-wttrin--mode-line-update-display-teardown)))
;;; Boundary Cases
@@ -223,7 +223,7 @@ trigger an emoji re-render so dimming matches the tooltip's staleness state."
(wttrin--mode-line-update-display)
;; Emoji should NOT be dimmed
(let ((face (get-text-property 1 'face wttrin-mode-line-string)))
- (should-not (and face (equal (plist-get face :foreground) "gray60")))))
+ (should-not (and face (eq (plist-get face :inherit) 'wttrin-mode-line-stale)))))
;; Time passes: data is now stale (age=2001, threshold=1800)
;; Invoke the tooltip (simulating a hover) — this should trigger a re-render
@@ -233,7 +233,7 @@ trigger an emoji re-render so dimming matches the tooltip's staleness state."
;; After hover detected staleness transition, emoji should now be dimmed
(let ((face (get-text-property 1 'face wttrin-mode-line-string)))
(should face)
- (should (equal (plist-get face :foreground) "gray60")))))
+ (should (eq (plist-get face :inherit) 'wttrin-mode-line-stale)))))
(test-wttrin--mode-line-update-display-teardown)))
;;; --------------------------------------------------------------------------