Release v2.7.0
Publish Docker Image / build-and-push (./build/Dockerfile, git.lzstealth.com/lzstealth/pulse-signage-web, web) (push) Successful in 1m18s
Publish Docker Image / build-and-push (./build/Dockerfile.player, git.lzstealth.com/lzstealth/pulse-signage-player, player) (push) Successful in 33s
Publish Docker Image / build-and-push (./build/Dockerfile, git.lzstealth.com/lzstealth/pulse-signage-web, web) (push) Successful in 1m18s
Publish Docker Image / build-and-push (./build/Dockerfile.player, git.lzstealth.com/lzstealth/pulse-signage-player, player) (push) Successful in 33s
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const vm = require('node:vm');
|
||||
|
||||
function loadTimeDateModule() {
|
||||
const webUiHelpersScript = fs.readFileSync(require.resolve('../src/web/public/js/web-ui-helpers.js'), 'utf8');
|
||||
const renderingScript = fs.readFileSync(require.resolve('../src/player/public/js/player-page-rendering.js'), 'utf8');
|
||||
const placeholderScript = fs.readFileSync(require.resolve('../src/web/public/js/shared/placeholder-utils.js'), 'utf8');
|
||||
const timeDateScript = fs.readFileSync(require.resolve('../src/player/regions/time-date.js'), 'utf8');
|
||||
const registry = new Map();
|
||||
const sandbox = {
|
||||
document: {
|
||||
addEventListener() {}
|
||||
},
|
||||
window: {
|
||||
pulsePlayerRegionTypes: {
|
||||
register(type, module) {
|
||||
registry.set(type, module);
|
||||
}
|
||||
},
|
||||
innerWidth: 1280,
|
||||
innerHeight: 720,
|
||||
Intl: Intl,
|
||||
Date: Date,
|
||||
Object: Object,
|
||||
Array: Array,
|
||||
Number: Number,
|
||||
String: String,
|
||||
Boolean: Boolean,
|
||||
Math: Math,
|
||||
JSON: JSON,
|
||||
RegExp: RegExp,
|
||||
console: console
|
||||
}
|
||||
};
|
||||
|
||||
sandbox.window = Object.assign({}, sandbox.window);
|
||||
|
||||
vm.runInNewContext(webUiHelpersScript, sandbox, { filename: 'web-ui-helpers.js' });
|
||||
sandbox.escapeHtml = sandbox.window.escapeHtml;
|
||||
vm.runInNewContext(renderingScript, sandbox, { filename: 'player-page-rendering.js' });
|
||||
vm.runInNewContext(placeholderScript, sandbox, { filename: 'placeholder-utils.js' });
|
||||
vm.runInNewContext(timeDateScript, sandbox, { filename: 'time-date.js' });
|
||||
|
||||
return registry.get('time-date');
|
||||
}
|
||||
|
||||
test('time/date region renders placeholder tokens on the player side', () => {
|
||||
const module = loadTimeDateModule();
|
||||
const markup = module.renderRegion(
|
||||
{
|
||||
pixelWidth: 320,
|
||||
pixelHeight: 180,
|
||||
canvasScale: 1,
|
||||
baseStyle: 'position:absolute;'
|
||||
},
|
||||
{
|
||||
value: '{{hh}}:{{mm}}',
|
||||
timezone: 'UTC'
|
||||
}
|
||||
);
|
||||
|
||||
assert.match(markup, /<p>\d{2}:\d{2}<\/p>/);
|
||||
});
|
||||
Reference in New Issue
Block a user