feat(config): add configuration window (#70)

This commit is contained in:
2026-05-21 04:16:21 -07:00
committed by GitHub
parent a54f03f0cd
commit dc52bc2fba
287 changed files with 14507 additions and 8134 deletions
@@ -0,0 +1,59 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { selectAutoplayStartupCue } from './autoplay-subtitle-primer';
test('selectAutoplayStartupCue returns the active cue at the current time', () => {
assert.deepEqual(
selectAutoplayStartupCue(
[
{ startTime: 1, endTime: 3, text: 'first' },
{ startTime: 4, endTime: 5, text: 'second' },
],
2,
1,
),
{ startTime: 1, endTime: 3, text: 'first' },
);
});
test('selectAutoplayStartupCue returns the next imminent cue before playback starts', () => {
assert.deepEqual(
selectAutoplayStartupCue(
[
{ startTime: 1.2, endTime: 3, text: 'first' },
{ startTime: 4, endTime: 5, text: 'second' },
],
0,
2,
),
{ startTime: 1.2, endTime: 3, text: 'first' },
);
});
test('selectAutoplayStartupCue clamps negative current time to startup', () => {
assert.deepEqual(
selectAutoplayStartupCue([{ startTime: 0, endTime: 1, text: 'startup' }], -0.5, 0),
{ startTime: 0, endTime: 1, text: 'startup' },
);
});
test('selectAutoplayStartupCue does not reveal far future subtitle text', () => {
assert.equal(
selectAutoplayStartupCue([{ startTime: 12, endTime: 15, text: 'later' }], 0, 2),
null,
);
});
test('selectAutoplayStartupCue skips blank cues', () => {
assert.deepEqual(
selectAutoplayStartupCue(
[
{ startTime: 0, endTime: 1, text: ' ' },
{ startTime: 0.5, endTime: 2, text: 'visible' },
],
0.75,
1,
),
{ startTime: 0.5, endTime: 2, text: 'visible' },
);
});