Release 2.21.6: sort editor regions by name
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile, web, pulse-signage-web) (push) Successful in 1m25s
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile.player, player, pulse-signage-player) (push) Successful in 34s

This commit is contained in:
lzstealth committed 2026-10-27 19:08:42 +00:00
1 parent 675483624b
commit 7748129307
8 files changed
+113 -8

No files matched your search

+9
View File
@@ -75,6 +75,15 @@ test('slide form queues editor image cleanup on save and close', () => {
assert.ok(slideFormSource.includes("regionMediaController.queueUploadCleanup(slideFormEditorController.getImageUploadCleanupPaths())"));
});
test('slide region cards and layout and animation selectors use name ordering', () => {
const layoutEditorSource = fs.readFileSync(require.resolve('../src/web/public/js/slides/slide-layout-editor.js'), 'utf8');
const animationEditorSource = fs.readFileSync(require.resolve('../src/web/public/js/slides/slide-animation-editor.js'), 'utf8');
assert.match(slideFormSource, /window\.templateDesignerUtils\.sortByName\(template\.regions\.filter/);
assert.match(layoutEditorSource, /window\.templateDesignerUtils\.sortByName\(regions\(\)/);
assert.match(animationEditorSource, /window\.templateDesignerUtils\.sortByName\(regions\(\)/);
});
test('media library selections keep image and video remove controls', () => {
assert.ok(mediaPickerSource.includes("var removeAction = isVideo ? 'region-video' : isQrImage ? 'region-qr-image' : 'region-image';"));
assert.ok(mediaPickerSource.includes('data-remove-\' + removeAction'));
+65
View File
@@ -381,6 +381,71 @@ test('template designer generates default region names per type', () => {
assert.ok(script.includes('Math.max(count, suffix)'));
});
test('region name sorting is case-insensitive, stable, and used by the template editor', () => {
const context = vm.createContext({ window: {} });
const utilsScript = fs.readFileSync(require.resolve('../src/web/public/js/templates/template-designer-utils.js'), 'utf8');
vm.runInContext(utilsScript, context);
const items = [
{ name: 'Zulu' },
{ name: 'alpha' },
{ name: 'Alpha' },
{ name: 'bravo' }
];
const sorted = Array.from(context.window.templateDesignerUtils.sortByName(items, item => item.name));
assert.deepEqual(sorted, [items[1], items[2], items[3], items[0]]);
const designerSource = fs.readFileSync(require.resolve('../src/web/public/js/templates/template-designer.js'), 'utf8');
assert.match(designerSource, /utils\.sortByName\(cards, getRegionName\)/);
});
test('template region selector sorts options and preserves the selected card index', () => {
const designerSource = fs.readFileSync(require.resolve('../src/web/public/js/templates/template-designer.js'), 'utf8');
const match = designerSource.match(/ function renderRegionSidebar\(\) \{[^]*?\n \}/);
assert.ok(match);
const cards = [
{ name: 'Zulu', hidden: false },
{ name: 'alpha', hidden: false },
{ name: 'Bravo', hidden: false }
];
const regionSelect = {
options: [],
disabled: false,
value: '',
set innerHTML(_value) { this.options = []; },
appendChild(option) { this.options.push(option); }
};
const regionList = { innerHTML: '' };
const context = vm.createContext({
cards,
regionSelect,
regionList,
selectedIndex: -1,
utils: { sortByName(items, getName) { return Array.from(items).sort((left, right) => getName(left).localeCompare(getName(right), undefined, { sensitivity: 'base' })); } },
getCards: () => cards,
getRegionName: card => card.name,
document: { createElement: () => ({}) },
updateCanvasSizeLock() {},
validateRegionNames() {},
updatePreviewCardVisibility() {}
});
vm.runInContext(match[0], context);
context.renderRegionSidebar();
assert.deepEqual(regionSelect.options.map(option => [option.textContent, option.value]), [
['alpha', '1'],
['Bravo', '2'],
['Zulu', '0']
]);
assert.equal(regionSelect.value, '1');
assert.deepEqual(cards.map(card => card.hidden), [true, false, true]);
context.selectedIndex = 0;
context.renderRegionSidebar();
assert.equal(regionSelect.value, '0');
assert.deepEqual(cards.map(card => card.hidden), [false, true, true]);
});
test('template designer warns when invalid region names block save', () => {
const script = fs.readFileSync(require.resolve('../src/web/public/js/templates/template-designer.js'), 'utf8');