aboutsummaryrefslogtreecommitdiff
path: root/tests/test-integration-chime-mode.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-04-04 14:11:48 -0500
committerCraig Jennings <c@cjennings.net>2026-04-04 14:11:48 -0500
commitffc9707790a3dff195bd827c17039faf0dcf44b0 (patch)
treeaece358117fc5a60c4da3d7c6f2404b758e369f9 /tests/test-integration-chime-mode.el
parent559231d91ca24a7a7b632261643b9f4eff329fbb (diff)
downloadchime-ffc9707790a3dff195bd827c17039faf0dcf44b0.tar.gz
chime-ffc9707790a3dff195bd827c17039faf0dcf44b0.zip
Show modeline icon immediately on chime-mode enable
Previously chime-modeline-string was nil until the first async check completed (~10-15 seconds after startup). Now the icon appears instantly with a "waiting for first event check" tooltip. On validation or async failure, the icon stays visible and the tooltip updates to show the error state instead of going blank.
Diffstat (limited to 'tests/test-integration-chime-mode.el')
-rw-r--r--tests/test-integration-chime-mode.el45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/test-integration-chime-mode.el b/tests/test-integration-chime-mode.el
index 0f19330..69ad176 100644
--- a/tests/test-integration-chime-mode.el
+++ b/tests/test-integration-chime-mode.el
@@ -65,5 +65,50 @@ and set it to nil."
;; Timer should be nil after disable
(should (null chime--timer))))
+(ert-deftest test-integration-chime-mode-enable-sets-modeline-string-immediately ()
+ "Enabling chime-mode should set chime-modeline-string to a non-nil value
+immediately, before the first async check completes."
+ (let ((chime-enable-modeline t)
+ (chime-modeline-lookahead-minutes 120)
+ (chime-modeline-no-events-text " ⏰"))
+ (unwind-protect
+ (progn
+ (chime-mode 1)
+ ;; Should be non-nil right away, not after startup delay
+ (should chime-modeline-string)
+ (should (stringp chime-modeline-string)))
+ (chime-mode -1))))
+
+(ert-deftest test-integration-chime-mode-enable-immediate-string-has-tooltip ()
+ "The immediate modeline string should have a help-echo tooltip."
+ (let ((chime-enable-modeline t)
+ (chime-modeline-lookahead-minutes 120)
+ (chime-modeline-no-events-text " ⏰"))
+ (unwind-protect
+ (progn
+ (chime-mode 1)
+ (should (get-text-property 0 'help-echo chime-modeline-string)))
+ (chime-mode -1))))
+
+(ert-deftest test-integration-chime-mode-validation-failure-keeps-icon-visible ()
+ "When validation fails, modeline should still show the icon with error info
+in the tooltip, not go blank."
+ (let ((chime-enable-modeline t)
+ (chime-modeline-lookahead-minutes 120)
+ (chime-modeline-no-events-text " ⏰")
+ (org-agenda-files nil)
+ (chime--validation-done nil)
+ (chime--validation-retry-count 0)
+ (chime-validation-max-retries 0))
+ (unwind-protect
+ (progn
+ (chime-mode 1)
+ ;; Force a check that will fail validation
+ (chime-check)
+ ;; Icon should still be visible, not nil
+ (should chime-modeline-string)
+ (should (stringp chime-modeline-string)))
+ (chime-mode -1))))
+
(provide 'test-integration-chime-mode)
;;; test-integration-chime-mode.el ends here