diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-26 12:39:36 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-26 12:39:36 -0400 |
| commit | 9459a0b30f86adb9066312672c7bd96e70bc1f6f (patch) | |
| tree | 2a0fa7d370aeeb9a9be69b63a224682c1a3b1f5d /tests | |
| parent | d4d12746e81348a55a25a1e40dbeac6a935e2825 (diff) | |
| download | emacs-wttrin-9459a0b30f86adb9066312672c7bd96e70bc1f6f.tar.gz emacs-wttrin-9459a0b30f86adb9066312672c7bd96e70bc1f6f.zip | |
feat: save the location to the directory when making it the default
Pressing d on a typed or aliased location set the favorite but never added it to wttrin-saved-locations, so the default persisted only as the favorite string, not as a named directory entry. The coordinate branch already saved. The typed/alias branch did not.
The typed/alias branch now puts the location into the directory before promoting it, so a typed default like "Reykjavik" persists as a ("Reykjavik" . "Reykjavik") entry. An empty-name coordinate detection still keeps the raw coordinates without saving an entry.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-wttrin-saved-locations.el | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/test-wttrin-saved-locations.el b/tests/test-wttrin-saved-locations.el index 0a7b8b3..c2f44b8 100644 --- a/tests/test-wttrin-saved-locations.el +++ b/tests/test-wttrin-saved-locations.el @@ -300,7 +300,24 @@ now-deleted alias's resolved weather and re-fetches against the bare query." ((symbol-function 'message) (lambda (&rest _) nil))) (wttrin-make-default))) (should-not prompted) - (should (equal "Craig's House" wttrin-favorite-location)))) + (should (equal "Craig's House" wttrin-favorite-location)) + (should (equal "1500 Sugar Bowl Dr" + (wttrin--resolve-location-query "Craig's House"))))) + +(ert-deftest test-wttrin-saved-locations-normal-d-typed-saves-to-directory () + "Normal: making a typed location the default also saves it to the directory, +so it persists as a named entry rather than only as the favorite string." + (let ((wttrin-saved-locations nil) + (wttrin-favorite-location nil) + (wttrin-mode-line-mode nil)) + (with-temp-buffer + (setq-local wttrin--current-location "Reykjavik") + (setq-local wttrin--current-display "Reykjavik") + (cl-letf (((symbol-function 'message) (lambda (&rest _) nil))) + (wttrin-make-default))) + (should (equal "Reykjavik" wttrin-favorite-location)) + (should (assoc "Reykjavik" (wttrin--saved-locations))) + (should (equal "Reykjavik" (wttrin--resolve-location-query "Reykjavik"))))) ;;; interactive entry smoke tests (cover the prompt forms) |
