Release v2.15.5
This commit is contained in:
1 parent
0e77998e92
commit
2fd059d35a
18 files changed
+385
-30
No files matched your search
@@ -130,6 +130,34 @@ test('timetable date ranges agree in preview and player, before limiting items',
|
||||
const config = { value: '{{title}}', timetable_group_id: 1, display_mode: 'upcoming', date_filter: 'between', date_from: '2099-08-20T00:00:00Z' };
|
||||
assert.doesNotMatch(previewModule.renderPreview({}, config, { timetableGroups: groups }), /Live/);
|
||||
assert.doesNotMatch(playerModule.renderRegion({}, config), /Live/);
|
||||
|
||||
groups[0].entries = [
|
||||
{ id: 5, title: 'Future', start_datetime: '2099-08-20T10:00:00Z' },
|
||||
groups[0].entries[0],
|
||||
{ id: 6, title: 'Past', start_datetime: '2000-08-20T10:00:00Z', end_datetime: '2000-08-20T11:00:00Z' }
|
||||
];
|
||||
const displayCases = [
|
||||
[{ display_mode: 'upcoming' }, ['Future']],
|
||||
[{ display_mode: 'current' }, ['Live']],
|
||||
[{ display_mode: 'both' }, ['Live', 'Future']],
|
||||
[{ display_mode: 'all' }, ['Past', 'Live', 'Future']],
|
||||
[{ display_mode: 'all', max_items: 1 }, ['Past']],
|
||||
[{ display_mode: 'all', date_filter: 'before', date_to: '2001-01-01T00:00:00Z' }, ['Past']],
|
||||
[{ display_mode: 'all', date_filter: 'after', date_from: '2099-01-01T00:00:00Z' }, ['Future']],
|
||||
[{ display_mode: 'all', date_filter: 'between', date_from: '2000-01-01T00:00:00Z', date_to: '2001-01-01T00:00:00Z' }, ['Past']]
|
||||
];
|
||||
for (const [settings, titles] of displayCases) {
|
||||
const content = { value: '{{title}}', timetable_group_id: 1, max_items: 5, ...settings };
|
||||
const outputs = [previewModule.renderPreview({}, content, { timetableGroups: groups }), playerModule.renderRegion({}, content)];
|
||||
for (const output of outputs) {
|
||||
for (const title of ['Past', 'Live', 'Future']) {
|
||||
assert.equal(output.includes(title), titles.includes(title), JSON.stringify(settings));
|
||||
}
|
||||
for (let index = 1; index < titles.length; index++) {
|
||||
assert.ok(output.indexOf(titles[index - 1]) < output.indexOf(titles[index]));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('timetable date controls default to all and pass unsaved date ranges to preview', () => {
|
||||
@@ -158,6 +186,9 @@ test('timetable date controls default to all and pass unsaved date ranges to pre
|
||||
assert.equal(context.date_from, '');
|
||||
assert.equal(context.date_to, fields['[name="region_date_to_47"]'].value);
|
||||
assert.doesNotMatch(html, /Use the selected group and display mode/);
|
||||
assert.match(html, /<option value="both">Current & Upcoming<\/option>/);
|
||||
const allMode = module.renderEditorCard({ region, current: { display_mode: 'all' }, timetableGroups: [] });
|
||||
assert.match(allMode, /<option value="all" selected>All<\/option>/);
|
||||
for (const mode of ['before', 'after']) {
|
||||
const current = { ...saved, date_filter: mode };
|
||||
const markup = module.renderEditorCard({ region, current, timetableGroups: [] });
|
||||
|
||||
Reference in new issue
Block a user