web-player: split player, navigation and accent state into focused modules

This commit is contained in:
2026-09-24 05:25:35 +02:00
parent e89463fb83
commit 5cda7cb4c1
47 changed files with 520 additions and 457 deletions
+15 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { findTopResult } from './search';
import { findTopResult, searchChips } from './search';
const empty = { tracks: [], albums: [], playlists: [], users: [] };
@@ -26,3 +26,17 @@ describe('findTopResult', () => {
expect(findTopResult({ ...empty, query: 'x' })).toBeNull();
});
});
describe('searchChips', () => {
it('adds an "all" chip with the total', () => {
const chips = searchChips({ tracks: 3, albums: 2, playlists: 0, users: 1 });
expect(chips.map((chip) => [chip.filter, chip.count])).toEqual([
['all', 6],
['tracks', 3],
['albums', 2],
['playlists', 0],
['users', 1]
]);
expect(chips[0].label).toBe('Todo');
});
});