1
0

Updates
All checks were successful
Test / test (push) Successful in 9m33s

This commit is contained in:
Aiden
2026-06-11 05:48:19 +10:00
parent a470d4bdc7
commit fbdb733f13
13 changed files with 310 additions and 15 deletions

View File

@@ -119,6 +119,52 @@ test('MediaController toggles loop playback state', () => {
assert.equal(video.loop, false);
});
test('MediaController restarts looping video just before the ended boundary', () => {
const { controller, video } = createController({
video: createVideo({
currentTime: 119.9,
duration: 120,
loop: true,
paused: false
})
});
controller.handleTimeUpdate();
assert.equal(video.currentTime, 0);
assert.equal(video.playCount, 1);
});
test('MediaController leaves non-looping or paused video alone near the ended boundary', () => {
const { controller: nonLoopingController, video: nonLoopingVideo } = createController({
video: createVideo({
currentTime: 119.9,
duration: 120,
loop: false,
paused: false
})
});
nonLoopingController.handleTimeUpdate();
assert.equal(nonLoopingVideo.currentTime, 119.9);
assert.equal(nonLoopingVideo.playCount, 0);
const { controller: pausedController, video: pausedVideo } = createController({
video: createVideo({
currentTime: 119.9,
duration: 120,
loop: true,
paused: true
})
});
pausedController.handleTimeUpdate();
assert.equal(pausedVideo.currentTime, 119.9);
assert.equal(pausedVideo.playCount, 0);
});
test('MediaController resets video and play button to poster state', () => {
const playButton = { classList: createClassList(), disabled: true };
playButton.classList.add('hidden');