feat: update subtitle sidebar overlay behavior

This commit is contained in:
2026-03-22 18:38:56 -07:00
parent 7d8d2ae7a7
commit 16f7b2507b
6 changed files with 200 additions and 30 deletions

View File

@@ -84,6 +84,18 @@ test('findActiveSubtitleCueIndex prefers timing match before text fallback', ()
assert.equal(findActiveSubtitleCueIndex(cues, { text: 'same', startTime: null }), 0);
});
test('findActiveSubtitleCueIndex prefers current subtitle timing over near-future clock lookahead', () => {
const cues = [
{ startTime: 231, endTime: 233.2, text: 'previous' },
{ startTime: 233.05, endTime: 236, text: 'next' },
];
assert.equal(
findActiveSubtitleCueIndex(cues, { text: 'previous', startTime: 231 }, 233, 0),
0,
);
});
test('subtitle sidebar modal opens from snapshot and clicking cue seeks playback', async () => {
const globals = globalThis as typeof globalThis & { window?: unknown; document?: unknown };
const previousWindow = globals.window;