openreader/tests/unit/icons-grid.spec.ts
Richard R 503319d46e style(ui): adjust sidebar hover effects and document skeleton timeout
Update FinderSidebar to remove background color on inactive hover for
improved visual clarity. Extend the DocumentSkeleton warning timeout to
10 seconds to allow more time before displaying the alert. Refine test
description for icons grid layout to clarify auto-fit behavior.
2026-05-29 21:49:13 -06:00

24 lines
1 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { iconsGridStyle, maxColumnsForIconGrid } from '../../src/components/doclist/views/iconsGrid';
test.describe('icons grid layout', () => {
test('calculates max columns from width and icon size', () => {
expect(maxColumnsForIconGrid('md', 136)).toBe(1);
expect(maxColumnsForIconGrid('md', 300)).toBe(2);
expect(maxColumnsForIconGrid('md', 1000)).toBe(6);
});
test('uses auto-fit by default when single-row suppression is off', () => {
const style = iconsGridStyle('md', 4);
expect(style.gridTemplateColumns).toContain('repeat(auto-fit');
expect(style.gridTemplateColumns).toContain('1fr');
expect(style.justifyContent).toBeUndefined();
});
test('disables stretch when single-row suppression is on', () => {
const style = iconsGridStyle('md', 4, { suppressSingleRowStretch: true });
expect(style.gridTemplateColumns).toContain('repeat(auto-fill');
expect(style.gridTemplateColumns).not.toContain('1fr');
expect(style.justifyContent).toBe('start');
});
});