Stop the last song from restarting and freezing service-mode lyrics

This commit is contained in:
Jonathan Sykes
2026-10-07 02:12:07 +08:00
parent 128f8e95e3
commit 2b286ae146
3 changed files with 11 additions and 1 deletions

View File

@@ -41,3 +41,9 @@ test('a new play after pause/source reset is not blocked by a stale promise', as
assert.equal(controller.play(audio), fresh); // old completion cannot discard the new request
finishes[1](); await fresh;
});
test('an ended element is never resumed (last song must not restart from 0)', () => {
let calls = 0;
const audio = { paused: true, ended: true, currentTime: 200, play() { calls++; return Promise.resolve(); } };
create().resume(audio, { currentTime: 200 });
assert.equal(calls, 0);
});