mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +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:
@@ -1,16 +1,26 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { computeCardGridColumnCount, CARD_GRID_MAX_COLS } from './cardGridLayout';
|
||||
import { computeCardGridColumnCount } from './cardGridLayout';
|
||||
import { LIBRARY_GRID_MAX_COLUMNS_MAX, LIBRARY_GRID_MAX_COLUMNS_MIN } from '../store/authStoreDefaults';
|
||||
|
||||
describe('computeCardGridColumnCount', () => {
|
||||
it('never exceeds CARD_GRID_MAX_COLS', () => {
|
||||
expect(computeCardGridColumnCount(20_000)).toBe(CARD_GRID_MAX_COLS);
|
||||
it('never exceeds the configured max', () => {
|
||||
expect(computeCardGridColumnCount(20_000, 6)).toBe(6);
|
||||
expect(computeCardGridColumnCount(20_000, 4)).toBe(4);
|
||||
});
|
||||
|
||||
it('clamps requested max to store-wide upper bound', () => {
|
||||
expect(computeCardGridColumnCount(20_000, 99)).toBe(LIBRARY_GRID_MAX_COLUMNS_MAX);
|
||||
});
|
||||
|
||||
it('clamps requested max to store-wide lower bound', () => {
|
||||
expect(computeCardGridColumnCount(20_000, 2)).toBe(LIBRARY_GRID_MAX_COLUMNS_MIN);
|
||||
});
|
||||
|
||||
it('returns at least one column', () => {
|
||||
expect(computeCardGridColumnCount(50)).toBe(1);
|
||||
expect(computeCardGridColumnCount(50, 6)).toBe(1);
|
||||
});
|
||||
|
||||
it('uses six columns on wide desktop widths', () => {
|
||||
expect(computeCardGridColumnCount(1200)).toBe(6);
|
||||
it('uses six columns on wide desktop when max allows', () => {
|
||||
expect(computeCardGridColumnCount(1200, 6)).toBe(6);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user