The first public release of Fabled Minstrel #158
@@ -14,6 +14,9 @@ describe('transport rules', () => {
|
|||||||
expect(canSkipNext({ index: 1, queue, repeat: 'off' })).toBe(true);
|
expect(canSkipNext({ index: 1, queue, repeat: 'off' })).toBe(true);
|
||||||
expect(canSkipNext({ index: 2, queue, repeat: 'off' })).toBe(false);
|
expect(canSkipNext({ index: 2, queue, repeat: 'off' })).toBe(false);
|
||||||
expect(canSkipNext({ index: 2, queue, repeat: 'all' })).toBe(true);
|
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', () => {
|
test('repeat labels name each mode', () => {
|
||||||
|
|||||||
@@ -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
|
/** 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 {
|
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 {
|
export function repeatLabel(mode: RepeatMode): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user