diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-13 15:03:43 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-13 15:03:43 -0500 |
| commit | a090138d84f3e93b2d57b38159cf0b3b7330fe11 (patch) | |
| tree | 6019ed952bbb802db90580017cbf7e82f6bd227c /scripts/theme-studio/test-app-core.mjs | |
| parent | 6d4461fc3264d6a730d32f1f8a5b58f78769a840 (diff) | |
| download | dotemacs-a090138d84f3e93b2d57b38159cf0b3b7330fe11.tar.gz dotemacs-a090138d84f3e93b2d57b38159cf0b3b7330fe11.zip | |
Update theme studio color columns and defaults
Diffstat (limited to 'scripts/theme-studio/test-app-core.mjs')
| -rw-r--r-- | scripts/theme-studio/test-app-core.mjs | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/scripts/theme-studio/test-app-core.mjs b/scripts/theme-studio/test-app-core.mjs index 39a44967..244dd6e3 100644 --- a/scripts/theme-studio/test-app-core.mjs +++ b/scripts/theme-studio/test-app-core.mjs @@ -7,7 +7,7 @@ import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; import { fileURLToPath } from 'node:url'; import { - nameToHex, buildPkgmap, packagesForExport, mergePackagesInto, effResolve, optList, slugify, + nameToHex, buildPkgmap, packagesForExport, mergePackagesInto, effResolve, optList, paletteOptionList, slugify, } from './app-core.js'; const here = fileURLToPath(new URL('.', import.meta.url)); @@ -44,6 +44,32 @@ test('optList: Error — a cur not in the palette is surfaced as (gone) first', assert.deepEqual(list.slice(2), PAL); }); +test('paletteOptionList: Normal — color choices follow visual column ordering', () => { + const pal = [ + ['#67809c', 'blue'], + ['#0d0b0a', 'bg'], + ['#808080', 'gray'], + ['#c0402a', 'red'], + ['#f0fef0', 'fg'], + ]; + const list = paletteOptionList('#67809c', pal, { bg: '#0d0b0a', fg: '#f0fef0' }); + assert.deepEqual(list.slice(0, 3), [['', '— default —'], ['#0d0b0a', 'bg'], ['#f0fef0', 'fg']]); + assert.ok(list.findIndex(([, name]) => name === 'blue') < list.findIndex(([, name]) => name === 'gray'), 'palette column order is preserved'); + assert.ok(list.findIndex(([, name]) => name === 'gray') < list.findIndex(([, name]) => name === 'red'), 'later columns stay later'); +}); + +test('paletteOptionList: Boundary — assignment-only ground colors are selectable', () => { + const list = paletteOptionList('', [['#67809c', 'blue']], { bg: '#0d0b0a', fg: '#f0fef0' }); + assert.ok(list.some(([hex, name]) => hex === '#0d0b0a' && name === 'bg')); + assert.ok(list.some(([hex, name]) => hex === '#f0fef0' && name === 'fg')); +}); + +test('paletteOptionList: Error — a cur outside palette and ground is surfaced as gone', () => { + const list = paletteOptionList('#123456', PAL, { bg: '#0d0b0a', fg: '#f0fef0' }); + assert.deepEqual(list[0], ['', '— default —']); + assert.deepEqual(list[1], ['#123456', '(gone) #123456']); +}); + test('buildPkgmap: Normal — seeds faces, resolving names and applying defaults', () => { const apps = { 'org-mode': { faces: [ ['org-todo', 'todo', { fg: 'blue', bold: true }], |
