Release v2.15.2
This commit is contained in:
1 parent
ddcc665f81
commit
7295f83f04
43 files changed
+2526
-104
No files matched your search
@@ -1003,6 +1003,57 @@ test('player page arrow keys move between slides', async () => {
|
||||
assert.deepEqual(calls, [0, 2]);
|
||||
});
|
||||
|
||||
test('manual forward wrap advances the playlist group pass', () => {
|
||||
const handlers = Object.create(null);
|
||||
const calls = [];
|
||||
const firstPassSlides = [{ id: 1 }, { id: 2 }];
|
||||
const nextPassSlides = [{ id: 3 }, { id: 4 }];
|
||||
const sandbox = {
|
||||
window: null,
|
||||
console,
|
||||
Array,
|
||||
Object,
|
||||
String,
|
||||
Boolean,
|
||||
Number,
|
||||
Math,
|
||||
Date,
|
||||
JSON,
|
||||
Promise,
|
||||
setTimeout,
|
||||
clearTimeout,
|
||||
location: { origin: 'http://localhost', href: 'http://localhost/screen/test2' },
|
||||
addEventListener(type, handler) { handlers[type] = handler; },
|
||||
slides: firstPassSlides,
|
||||
lastRenderedSlide: { id: 2 },
|
||||
index: 1,
|
||||
playlistPassNumber: 0,
|
||||
timer: null,
|
||||
slideOutroTimers: [],
|
||||
getCurrentActiveSlides() { return sandbox.playlistPassNumber ? nextPassSlides : firstPassSlides; },
|
||||
clearSlideTimer() {},
|
||||
clearActiveSlidesCache() {},
|
||||
applyPendingPlaylistUpdate() {},
|
||||
renderSlideAtIndex(sourceSlides, targetIndex) { calls.push({ sourceSlides, targetIndex }); }
|
||||
};
|
||||
sandbox.window = sandbox;
|
||||
|
||||
const scriptPath = path.join(__dirname, '..', 'src', 'player', 'public', 'js', 'player-page-commands.js');
|
||||
vm.runInNewContext(fs.readFileSync(scriptPath, 'utf8'), sandbox, { filename: scriptPath });
|
||||
sandbox.navigateSlides(1);
|
||||
|
||||
assert.equal(sandbox.playlistPassNumber, 1);
|
||||
assert.deepEqual(calls, [{ sourceSlides: nextPassSlides, targetIndex: 0 }]);
|
||||
const repeated = [{ id: 1 }, { id: 2 }, { id: 1 }, { id: 2 }, { id: 9 }];
|
||||
sandbox.getCurrentActiveSlides = () => repeated;
|
||||
sandbox.index = 3;
|
||||
sandbox.lastRenderedSlide = { id: 2 };
|
||||
sandbox.navigateSlides(1);
|
||||
assert.equal(calls.at(-1).targetIndex, 4);
|
||||
sandbox.navigateSlides(-1);
|
||||
assert.equal(calls.at(-1).targetIndex, 2);
|
||||
});
|
||||
|
||||
test('playlist removal of the current slide queues without rerendering it immediately', async () => {
|
||||
const calls = {
|
||||
showCurrent: 0,
|
||||
|
||||
Reference in new issue
Block a user