aboutsummaryrefslogtreecommitdiffstats
path: root/tools/media-timeline-test.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/media-timeline-test.js')
-rw-r--r--tools/media-timeline-test.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/media-timeline-test.js b/tools/media-timeline-test.js
index c8f1fd9..3b812ff 100644
--- a/tools/media-timeline-test.js
+++ b/tools/media-timeline-test.js
@@ -54,27 +54,27 @@ try {
const url = 'https://example.com/song.mp3';
const ev = { id: 'post', tags: [['imeta', 'url ' + url, 'waveform 1 10 4 8']] };
const calls = [], items = [{ id: 'a', moment: { seconds: 30 }, icon: '♡', text: 'Nice!' }];
- const box = mediaTimeline(player, url, { h, event: () => ev, moments: () => items, action: (...a) => calls.push(a.slice(0, 3)), label: x => ({ mediaAtTime: 'at this time' }[x] || x) });
+ const box = mediaTimeline(player, url, { h, event: () => ev, moments: () => items, glyph: x => x.icon, label: x => x });
document.body.append(player, box);
player.dispatchEvent(new Event('timeupdate'));
const wave = box.querySelectorAll('.media-wave i').length;
const range = box.querySelector('input'); range.value = 500; range.dispatchEvent(new Event('input'));
const seek = at;
- for (const b of box.querySelectorAll('.media-moment-actions button')) b.click();
box.querySelector('.media-mark').click();
const marker = at;
items.push({ id: 'b', moment: { seconds: 70 }, icon: '⚡', text: '' });
player.dispatchEvent(new Event('mediaactivity'));
window.fixture = box;
- return { wave, seek, marker, calls, markers: box.querySelectorAll('.media-mark').length, aria: range.getAttribute('aria-valuetext') };
+ return { wave, seek, marker, calls, markers: box.querySelectorAll('.media-mark').length, left: [...box.querySelectorAll('.media-mark')].map(m => m.style.left), buttons: box.querySelectorAll('button:not(.media-mark)').length, aria: range.getAttribute('aria-valuetext') };
});
assert.equal(result.wave, 4);
assert.equal(result.seek, 60);
assert.equal(result.marker, 30);
assert.equal(result.markers, 2);
- assert.deepEqual(result.calls.map(c => [c[0], c[1].id, c[2].seconds]), [['comment', 'post', 60], ['reaction', 'post', 60], ['zap', 'post', 60]]);
+ assert.deepEqual(result.left, ['25%', '58.3333%']); // each on the bar at its moment
+ assert.equal(result.buttons, 0); // no "at this time" buttons
await page.setViewport({ width: 360, height: 740 });
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true);
await page.screenshot({ path: '/tmp/media-timeline-mobile.png' });
- console.log('✓ Timestamp validation, Lightning receipt round-trip, untimed zap isolation, waveform peaks, browser seeking, all three actions, marker updates and mobile layout');
+ console.log('✓ Timestamp validation, Lightning receipt round-trip, untimed zap isolation, waveform peaks, browser seeking, markers placed at their moments and mobile layout');
} finally { await browser.close(); server.stop(); }