aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-18 22:06:53 -0500
committerCraig Jennings <c@cjennings.net>2026-06-18 22:06:53 -0500
commite110f7afac89322a2af4f3c4ebafe303be044cc2 (patch)
treef2b24d43f3c38044bd6127e11be43b157a7db0e5 /tests
parent64153c8d995f1603986f3b44ccbdf9ddb21dfd55 (diff)
downloaddotemacs-e110f7afac89322a2af4f3c4ebafe303be044cc2.tar.gz
dotemacs-e110f7afac89322a2af4f3c4ebafe303be044cc2.zip
refactor(theme-studio): cut the face model over to weight/slant/objects
I replaced the legacy bold/italic/underline/strike booleans with the final model shape across both sides of the tool. weight (light/normal/medium/semibold/bold/heavy) and slant (normal/italic/oblique) replace the bold/italic flags, underline becomes {style: line|wave, color}, strike becomes {color}, and null means unset. A single migration converts a legacy face on the way in, mirrored as migrateLegacyFace in app-core.js and migrate_legacy in face_specs.py so the JS and Python models can't drift. It runs on import (applyImported, mergePackagesInto) and on every seed that face_spec touches. The captured-snapshot seed (default_faces.seed) narrows the same way it did before. Only bold and italic survive, as weight "bold" and slant "italic", so the generated themes stay byte-identical. The B/I/U/S toggle buttons keep working through a transitional bridge (legacyStyleOn / toggleLegacyStyle). The weight/slant dropdowns and underline/strike controls that replace them land next. The live previews read the new shape, with a weight name mapped to a numeric CSS font-weight. The cutover is proven emit-neutral two ways. An ERT test asserts the migrated shapes emit the same attributes as the legacy booleans, and deep-migrating every face in dupre, distinguished, sterling, now, theme, and WIP then running build-theme yields byte-identical output. Full suite green: Python 59, Node 200, ERT 41, plus the browser hash gates.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-build-theme.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test-build-theme.el b/tests/test-build-theme.el
index 29607d099..8793da73a 100644
--- a/tests/test-build-theme.el
+++ b/tests/test-build-theme.el
@@ -181,6 +181,19 @@ drift the way Craig's downloaded exports under scripts/theme-studio/ can.")
(should (equal (build-theme/--attrs '((strike . ((color . "#cb6b4d")))))
'(:strike-through "#cb6b4d"))))
+(ert-deftest test-build-theme-attrs-migrated-shapes-match-legacy ()
+ "Boundary: the shapes the import migration produces emit identically to the
+legacy booleans they replace, so the cutover keeps generated themes byte-identical.
+Mirrors migrateLegacyFace (app-core.js) / migrate_legacy (face_specs.py)."
+ (should (equal (build-theme/--attrs '((weight . "bold")))
+ (build-theme/--attrs '((bold . t)))))
+ (should (equal (build-theme/--attrs '((slant . "italic")))
+ (build-theme/--attrs '((italic . t)))))
+ (should (equal (build-theme/--attrs '((underline . ((style . "line") (color . nil)))))
+ (build-theme/--attrs '((underline . t)))))
+ (should (equal (build-theme/--attrs '((strike . ((color . nil)))))
+ (build-theme/--attrs '((strike . t))))))
+
(ert-deftest test-build-theme-attrs-overline ()
"Normal/Boundary: overline emits t for no color, the color otherwise, nil when unset."
(should (equal (build-theme/--attrs '((overline . ((color . nil))))) '(:overline t)))