Release v2.5.6
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
require('../src/common');
|
||||
|
||||
const { buildDuplicatePlaylistName, buildDuplicatePlaylist } = require('../src/web/routes/signage/playlists/duplicate');
|
||||
const renderPlaylistFormPage = require('../src/web/routes/signage/playlists/add');
|
||||
|
||||
test('buildDuplicatePlaylist copies playlist fields for the create page', () => {
|
||||
const duplicate = buildDuplicatePlaylist({
|
||||
id: 12,
|
||||
name: 'Lunch Loop',
|
||||
fade_between_slides: 1,
|
||||
skip_unavailable_rtmp: 0,
|
||||
canvas_id: 7
|
||||
}, buildDuplicatePlaylistName('Lunch Loop'));
|
||||
|
||||
assert.equal(duplicate.id, 12);
|
||||
assert.equal(duplicate.name, 'Copy of Lunch Loop');
|
||||
assert.equal(duplicate.fade_between_slides, true);
|
||||
assert.equal(duplicate.skip_unavailable_rtmp, false);
|
||||
assert.equal(duplicate.canvas_id, 7);
|
||||
});
|
||||
|
||||
test('playlist duplicate form page reuses the copied playlist id for rows', async () => {
|
||||
const html = await renderPlaylistFormPage(
|
||||
{ id: 12, name: 'Copy of Lunch Loop', fade_between_slides: true, skip_unavailable_rtmp: false, canvas_id: 7 },
|
||||
'Review the copied values and save when ready.',
|
||||
{ permissionKeys: ['playlists.create'] },
|
||||
{
|
||||
playlists: [],
|
||||
canvasSizes: [{ id: 7, name: 'HD', width: 1280, height: 720 }],
|
||||
slides: [
|
||||
{ id: 3, title: 'Welcome', template_id: 8, content_json: '{}', thumbnail_path: '', canvas_size_id: 7, canvas_width: 1280, canvas_height: 720 }
|
||||
],
|
||||
playlistSlides: [
|
||||
{ id: 21, playlist_id: 12, position: 0, duration_seconds: 10, use_video_duration: 0, disable_audio: 1, slide_id: 3, title: 'Welcome', content_json: '{}', thumbnail_path: '', canvas_size_id: 7, canvas_width: 1280, canvas_height: 720, scheduleRules: [] }
|
||||
]
|
||||
},
|
||||
null
|
||||
);
|
||||
|
||||
assert.match(html, /Copy of Lunch Loop/);
|
||||
assert.match(html, /data-playlist-id="12"/);
|
||||
assert.match(html, /Welcome/);
|
||||
assert.match(html, /Save and Close/);
|
||||
});
|
||||
|
||||
test('playlist list template includes duplicate action', () => {
|
||||
const template = fs.readFileSync(path.join(__dirname, '..', 'src', 'web', 'views', 'signage', 'playlists', 'list.hbs'), 'utf8');
|
||||
|
||||
assert.match(template, /\/playlists\/\{\{id\}\}\/duplicate/);
|
||||
assert.match(template, />Dupe<\/a>/);
|
||||
});
|
||||
Reference in New Issue
Block a user