aboutsummaryrefslogtreecommitdiff
path: root/scripts/theme-studio/test-app-core.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/theme-studio/test-app-core.mjs')
-rw-r--r--scripts/theme-studio/test-app-core.mjs26
1 files changed, 25 insertions, 1 deletions
diff --git a/scripts/theme-studio/test-app-core.mjs b/scripts/theme-studio/test-app-core.mjs
index 29c43abd..195846e7 100644
--- a/scripts/theme-studio/test-app-core.mjs
+++ b/scripts/theme-studio/test-app-core.mjs
@@ -11,7 +11,7 @@ import {
clearPalettePlan, deletePaletteColumnPlan, groundColumnMembersFromPalette, areAllLocked, lockToggleLabel, toggleLockSet,
galleryModel, appViewKeysSorted, faceBoxNonDefaults, overflowNonDefault, stepViewIndex,
cssWeight, faceDecoration, boxCss, faceCss, composeHoverTitle,
- clampHeight, HEIGHT_MIN, HEIGHT_MAX, heightControlKind, parseHeightEntry, ptHint,
+ clampHeight, HEIGHT_MIN, HEIGHT_MAX, heightControlKind, parseHeightEntry, ptHint, heightCssValue,
} from './app-core.js';
import { planPaletteGenerator, entriesForGeneratedColumn } from './palette-generator-core.js';
import { oklch2hex, deltaE } from './colormath.js';
@@ -1098,6 +1098,30 @@ test('ptHint: Boundary — no number, no hint', () => {
assert.equal(ptHint(null), '');
assert.equal(ptHint(undefined), '');
});
+
+test('heightCssValue: Normal — relative renders as em, absolute as true pt', () => {
+ assert.equal(heightCssValue({ height: 1.3, heightMode: 'rel' }), '1.3em');
+ assert.equal(heightCssValue({ height: 130, heightMode: 'abs' }), '13pt');
+ // the integral-float case: the stored kind rules, not the number type
+ assert.equal(heightCssValue({ height: 2, heightMode: 'rel' }), '2em');
+});
+
+test('heightCssValue: Normal — a legacy object without a kind infers from the number', () => {
+ assert.equal(heightCssValue({ height: 1.4 }), '1.4em');
+ assert.equal(heightCssValue({ height: 130 }), '13pt');
+});
+
+test('heightCssValue: Boundary — unset, identity, or non-number yields null', () => {
+ assert.equal(heightCssValue({ height: null }), null);
+ assert.equal(heightCssValue({ height: 1 }), null);
+ assert.equal(heightCssValue({}), null);
+ assert.equal(heightCssValue(null), null);
+});
+
+test('faceCss: Normal — a string fontSize lands verbatim, a number stays em', () => {
+ assert.ok(faceCss({}, '#111', null, { fontSize: '13pt' }).includes('font-size:13pt'));
+ assert.ok(faceCss({}, '#111', null, { fontSize: 1.15 }).includes('font-size:1.15em'));
+});
test('faceBoxNonDefaults: inherit and box differences are flagged', () => {
assert.equal(faceBoxNonDefaults({ inherit: 'bold' }, { inherit: null }).inherit, true);
assert.equal(faceBoxNonDefaults({ box: { style: 'line' } }, { box: null }).box, true);