aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-14 21:36:08 -0500
committerCraig Jennings <c@cjennings.net>2026-06-14 21:36:08 -0500
commit5a22ebcdb6a9f7fd8de51c52b1548d88f84adbd2 (patch)
treea7bb6382a29004088585a7828548c9b538c85e0e /tests
parent59f4f54e518db3323cd7aaabfdc48ecb2bdaf40d (diff)
downloaddotemacs-5a22ebcdb6a9f7fd8de51c52b1548d88f84adbd2.tar.gz
dotemacs-5a22ebcdb6a9f7fd8de51c52b1548d88f84adbd2.zip
fix(theme-studio): name exported themes from the source filename
The converter took the theme name from the JSON's internal name field, so every draft whose field read "theme" overwrote theme-theme.el. It now uses the JSON file's basename, so WIP.json becomes WIP-theme.el and each draft lands under its own name. The reload target derives the load name from the basename too, and a regression test pins it: the filename wins over the internal field.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-build-theme.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test-build-theme.el b/tests/test-build-theme.el
index bf45f3807..9221946e6 100644
--- a/tests/test-build-theme.el
+++ b/tests/test-build-theme.el
@@ -320,6 +320,25 @@ including an inherit+height package face."
(test-build-theme--with-sandbox out
(should-error (build-theme/convert-file (expand-file-name "does-not-exist.json" out) out))))
+(ert-deftest test-build-theme-name-from-filename-not-json-field ()
+ "Normal/Regression: the output name comes from the JSON file's basename, not
+its internal name field, so each draft exports under its own name (a WIP.json
+becomes WIP-theme.el, never theme-theme.el)."
+ (test-build-theme--with-sandbox out
+ ;; The fixture's internal name field is \"dupre-fixture\"; the file is sterling.json.
+ (let ((in (expand-file-name "sterling.json" out)))
+ (with-temp-file in (insert test-build-theme--fixture-json))
+ (let ((path (build-theme/convert-file in out)))
+ (should (string-suffix-p "sterling-theme.el" path))
+ (should-not (string-match-p "dupre-fixture" path))
+ (let ((custom-theme-load-path (cons out custom-theme-load-path))
+ (load-path (cons out load-path)))
+ (unwind-protect
+ (progn
+ (load-theme 'sterling t)
+ (should (string= (face-attribute 'default :background nil t) "#000000")))
+ (disable-theme 'sterling)))))))
+
(ert-deftest test-build-theme-generated-default-meets-wcag-aa ()
"Error/Regression: the generated default face stays legible.
A WCAG-AA (>= 4.5:1) assertion on the round-tripped result -- proves the whole