diff --git a/web/src/lib/player/controls.test.ts b/web/src/lib/player/controls.test.ts index 5322f211..2bb832c9 100644 --- a/web/src/lib/player/controls.test.ts +++ b/web/src/lib/player/controls.test.ts @@ -14,6 +14,9 @@ describe('transport rules', () => { expect(canSkipNext({ index: 1, queue, repeat: 'off' })).toBe(true); expect(canSkipNext({ index: 2, queue, repeat: 'off' })).toBe(false); expect(canSkipNext({ index: 2, queue, repeat: 'all' })).toBe(true); + // Repeat one repeats a track as it ends; an explicit Next at the end of + // the queue stops, so the button is off as with repeat off. + expect(canSkipNext({ index: 2, queue, repeat: 'one' })).toBe(false); }); test('repeat labels name each mode', () => { diff --git a/web/src/lib/player/controls.ts b/web/src/lib/player/controls.ts index feb641ad..d0fd60d3 100644 --- a/web/src/lib/player/controls.ts +++ b/web/src/lib/player/controls.ts @@ -16,9 +16,10 @@ export function canSkipPrev(p: { index: number; position: number }): boolean { } /** Whether Next does anything: there is a track after this one, or the - queue wraps round. */ + queue wraps round (repeat all). Repeat one doesn't count: an explicit + Next at the end stops there, as with repeat off (store.skipNext). */ export function canSkipNext(p: { index: number; queue: readonly unknown[]; repeat: RepeatMode }): boolean { - return !(p.index === p.queue.length - 1 && p.repeat === 'off'); + return p.index + 1 < p.queue.length || p.repeat === 'all'; } export function repeatLabel(mode: RepeatMode): string {