Release v2.14.2
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile, web, pulse-signage-web) (push) Successful in 1m11s
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile.player, player, pulse-signage-player) (push) Successful in 30s

This commit is contained in:
lzstealth committed 2026-10-12 00:56:09 +01:00
1 parent c3299abaac
commit ddcc665f81
47 files changed
+1209 -66

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const vm = require('node:vm');
function loadRegionRenderer(regionType, dataKey, data) {
let renderer;
const window = {
placeholderUtils: {},
pulsePlayerRegionTypes: {
register: function (_type, module) {
renderer = module;
}
},
pulsePlayerRenderingShared: {
normalizeRegionValue: function (value) {
return String(value || '');
}
}
};
const context = {
window,
initialData: { [dataKey]: data },
escapeHtml: String,
sanitizeFontFamily: String,
sanitizeFontSize: function (value) { return Number(value) || 16; },
sanitizeTextColor: String,
sanitizeRichText: String,
renderEditorJsContent: String
};
vm.runInNewContext(fs.readFileSync(path.join(__dirname, '../src/web/public/js/shared/placeholder-utils.js'), 'utf8'), context);
vm.runInNewContext(fs.readFileSync(path.join(__dirname, '../src/player/regions', regionType + '.js'), 'utf8'), context);
return renderer;
}
test('image placeholders align inline with text in player API and RSS regions', function () {
const sourceUrl = 'https://example.com/image.png';
const api = loadRegionRenderer('api', 'apiSources', [{
id: 1,
responseJson: { image: sourceUrl }
}]);
const rss = loadRegionRenderer('rss', 'rssFeeds', [{
id: 1,
items: [{ image: sourceUrl }]
}]);
const region = { pixelWidth: 400, pixelHeight: 100, canvasScale: 1, baseStyle: '' };
for (const [renderer, contentKey] of [[api, 'source_id'], [rss, 'feed_id']]) {
const content = { [contentKey]: 1, value: 'Before {{image.image(120,80,bottom)}} after' };
const rendered = renderer.renderRegion(region, content);
assert.match(rendered, /vertical-align:bottom/);
assert.match(rendered, /width:120px;height:80px/);
const legacy = renderer.renderRegion(region, { [contentKey]: 1, value: 'Before {{image.image(120,80)}} after' });
assert.doesNotMatch(legacy, /vertical-align:/);
assert.match(legacy, /width:120px;height:80px/);
}
});