Release 2.21.2: fix animation timing
This commit is contained in:
1 parent
c923dcc1c5
commit
554678b3c4
13 files changed
+151
-54
No files matched your search
@@ -1181,4 +1181,50 @@ test('playlist removal of the current slide queues without rerendering it immedi
|
||||
assert.equal(JSON.stringify(sandbox.slides), JSON.stringify([{ id: 1, duration_seconds: 12 }, { id: 2, duration_seconds: 12 }]));
|
||||
assert.equal(calls.showCurrent, 0);
|
||||
assert.equal(calls.logDebug.some((entry) => entry.includes('applying on next slide transition')), true);
|
||||
});
|
||||
|
||||
test('player applies animation delays and schedules outro triggers to finish at slide advance', () => {
|
||||
const animationPath = path.join(__dirname, '..', 'src', 'player', 'public', 'js', 'player-page-animation.js');
|
||||
const transitionPath = path.join(__dirname, '..', 'src', 'player', 'public', 'js', 'player-page-transition.js');
|
||||
const values = {};
|
||||
const classes = new Set();
|
||||
const config = JSON.stringify({
|
||||
intro: { preset: 'fadeIn', duration_ms: 600, delay_ms: 250 },
|
||||
outro: { preset: 'fadeOut', duration_ms: 700, delay_ms: 400 }
|
||||
});
|
||||
const element = {
|
||||
dataset: {},
|
||||
isConnected: true,
|
||||
style: {
|
||||
setProperty(name, value) { values[name] = value; },
|
||||
removeProperty(name) { delete values[name]; }
|
||||
},
|
||||
classList: {
|
||||
add(...names) { names.forEach(name => classes.add(name)); },
|
||||
remove(...names) { names.forEach(name => classes.delete(name)); },
|
||||
[Symbol.iterator]() { return classes[Symbol.iterator](); }
|
||||
},
|
||||
getAttribute(name) { return name === 'data-animation-json' ? config : null; },
|
||||
addEventListener() {},
|
||||
removeEventListener() {},
|
||||
querySelectorAll() { return []; }
|
||||
};
|
||||
const root = { querySelectorAll() { return [element]; } };
|
||||
const timers = [];
|
||||
const sandbox = {
|
||||
window: null,
|
||||
app: { querySelectorAll() { return [root]; }, firstElementChild: root },
|
||||
setTimeout(callback, delay) { timers.push({ callback, delay }); return timers.length; },
|
||||
clearTimeout() {}
|
||||
};
|
||||
sandbox.window = sandbox;
|
||||
vm.runInNewContext(fs.readFileSync(animationPath, 'utf8') + '\n' + fs.readFileSync(transitionPath, 'utf8'), sandbox);
|
||||
|
||||
sandbox.playRegionAnimation(element, 'intro');
|
||||
assert.equal(values['animation-delay'], '250ms');
|
||||
|
||||
sandbox.scheduleSlideOutro(5000);
|
||||
assert.equal(timers[0].delay, 3900);
|
||||
timers[0].callback();
|
||||
assert.equal(values['animation-delay'], undefined);
|
||||
});
|
||||
Reference in new issue
Block a user