mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 14:35:41 +00:00
feat(settings): library card grid max columns in Appearance (4–12, default 6)
Persist libraryGridMaxColumns, wire useCardGridMetrics and card grid layout, add i18n and settings search index; document performance hint in copy.
This commit is contained in:
@@ -30,6 +30,10 @@ vi.mock('@/api/subsonic', () => ({
|
||||
import { useAuthStore } from './authStore';
|
||||
import { resetAuthStore, resetPlayerStore } from '@/test/helpers/storeReset';
|
||||
import { onInvoke } from '@/test/mocks/tauri';
|
||||
import {
|
||||
LIBRARY_GRID_MAX_COLUMNS_MAX,
|
||||
LIBRARY_GRID_MAX_COLUMNS_MIN,
|
||||
} from './authStoreDefaults';
|
||||
|
||||
beforeEach(() => {
|
||||
resetAuthStore();
|
||||
@@ -120,6 +124,17 @@ describe('setters with validation / clamping', () => {
|
||||
expect(useAuthStore.getState().trackPreviewDurationSec).toBe(31);
|
||||
});
|
||||
|
||||
it('setLibraryGridMaxColumns clamps to the allowed column range', () => {
|
||||
useAuthStore.getState().setLibraryGridMaxColumns(99);
|
||||
expect(useAuthStore.getState().libraryGridMaxColumns).toBe(LIBRARY_GRID_MAX_COLUMNS_MAX);
|
||||
|
||||
useAuthStore.getState().setLibraryGridMaxColumns(1);
|
||||
expect(useAuthStore.getState().libraryGridMaxColumns).toBe(LIBRARY_GRID_MAX_COLUMNS_MIN);
|
||||
|
||||
useAuthStore.getState().setLibraryGridMaxColumns(6);
|
||||
expect(useAuthStore.getState().libraryGridMaxColumns).toBe(6);
|
||||
});
|
||||
|
||||
it('setTrackPreviewsEnabled coerces truthy/falsy to boolean', () => {
|
||||
useAuthStore.getState().setTrackPreviewsEnabled('yes' as unknown as boolean);
|
||||
expect(useAuthStore.getState().trackPreviewsEnabled).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user