Release v2.15.5
This commit is contained in:
1 parent
0e77998e92
commit
2fd059d35a
18 files changed
+385
-30
No files matched your search
@@ -2,6 +2,35 @@ const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
const { buildSlidePayload } = require('../src/data/slides');
|
||||
const { normalizeDisplayMode } = require('../src/data/timetables');
|
||||
|
||||
test('thumbnail timetable regions resolve entries instead of displaying placeholders', () => {
|
||||
const { buildThumbnailPreviewPayload } = require('../src/web/lib/media/slide-thumbnails');
|
||||
const slide = {
|
||||
template: { regions: [{ region_key: 'agenda', region_type: 'timetable', width: 600, height: 300 }] },
|
||||
content: { agenda: { value: '<p>{{index}}: {{title}} at {{start.time(HH:mm,"Europe/Amsterdam")}}</p>', timetable_group_id: 7, display_mode: 'all', max_items: 1 } }
|
||||
};
|
||||
const options = { timetableGroups: [{ id: 7, timezone: 'Europe/Amsterdam', entries: [
|
||||
{ id: 2, title: 'Later', start_datetime: '2099-01-01T12:00:00Z' },
|
||||
{ id: 1, title: 'Opening & welcome', start_datetime: '2099-01-01T10:00:00Z' }
|
||||
] }] };
|
||||
const payload = buildThumbnailPreviewPayload(slide, options);
|
||||
assert.match(payload.html, /1: Opening & welcome at 11:00/);
|
||||
assert.doesNotMatch(payload.html, /\{\{|Later/);
|
||||
slide.content.agenda.date_filter = 'after';
|
||||
slide.content.agenda.date_from = '2099-01-01T11:00:00Z';
|
||||
const filtered = buildThumbnailPreviewPayload(slide, options);
|
||||
assert.match(filtered.html, /1: Later at 13:00/);
|
||||
assert.doesNotMatch(filtered.html, /Opening|\{\{/);
|
||||
assert.doesNotMatch(buildThumbnailPreviewPayload(slide, {}).html, /\{\{|Opening|Later/);
|
||||
});
|
||||
|
||||
test('timetable display mode normalization accepts all and preserves existing modes', () => {
|
||||
for (const mode of ['upcoming', 'current', 'both', 'all']) {
|
||||
assert.equal(normalizeDisplayMode(mode.toUpperCase()), mode);
|
||||
}
|
||||
assert.equal(normalizeDisplayMode('invalid'), 'upcoming');
|
||||
});
|
||||
|
||||
test('buildSlidePayload normalizes timetable region fields', async () => {
|
||||
const pool = {
|
||||
@@ -65,6 +94,7 @@ test('timetable date settings persist, clear, default to all, and reject invalid
|
||||
return JSON.parse(payload.contentJson).timetable;
|
||||
}
|
||||
assert.equal((await save({})).date_filter, 'all');
|
||||
assert.equal((await save({ region_timetable_display_mode_47: 'all' })).display_mode, 'all');
|
||||
assert.equal((await save({}, existing)).date_from, '2099-08-20T10:00:00.000Z');
|
||||
assert.equal((await save({ region_date_from_47: '' }, existing)).date_from, '');
|
||||
const all = await save({ region_date_filter_47: 'all' }, existing);
|
||||
|
||||
Reference in new issue
Block a user