Mediabibliotheek: tegels als standaardweergave, schakelaar tegels/lijst met onthouden keuze
Continuous Integration / config-sls (pull_request) Successful in 8s
Continuous Integration / config-asf (pull_request) Successful in 8s
Continuous Integration / changes (pull_request) Successful in 15s
Continuous Integration / backend-build (pull_request) Successful in 1m57s
Continuous Integration / compile-sites (pull_request) Successful in 1m57s
Continuous Integration / vulnerability-scan (pull_request) Successful in 1m44s
Continuous Integration / frontend-prepare (pull_request) Successful in 29s
Continuous Integration / frontend-build (pull_request) Successful in 1m18s
Continuous Integration / backend-test (pull_request) Successful in 3m41s
Continuous Integration / frontend-test (pull_request) Successful in 3m15s
Continuous Integration / frontend-lint (pull_request) Successful in 3m46s
Continuous Integration / publish-sls-test (pull_request) Skipped
Continuous Integration / publish-sls-production (pull_request) Skipped
Continuous Integration / deploy-sls-test (pull_request) Skipped
Continuous Integration / deploy-sls-production (pull_request) Skipped
Continuous Integration / publish-asf-test (pull_request) Skipped
Continuous Integration / deploy-asf-test (pull_request) Skipped
Continuous Integration / smoke-sls-test (pull_request) Skipped
Continuous Integration / smoke-asf-test (pull_request) Skipped

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 20:01:07 +01:00
co-authored by Claude Sonnet 5.5
parent e7443e6e82
commit e2d353b54d
7 changed files with 165 additions and 55 deletions
@@ -23,6 +23,7 @@ function renderPage() {
}
beforeEach(async () => {
window.localStorage.removeItem('slp.media.layout');
await i18n.changeLanguage('nl');
});
@@ -289,6 +290,36 @@ describe('MediaLibraryPage', () => {
expect(await screen.findByTestId('purge-partial')).toHaveTextContent('1 foto kon niet worden verwijderd');
});
it('shows tiles by default, switches to a list, remembers the choice and keeps every function in both', async () => {
const first = renderPage();
await screen.findByTestId('photo-selection-list');
expect(screen.getByTestId('photo-items')).toHaveAttribute('data-layout', 'tiles');
expect(screen.getByTestId('layout-tiles')).toHaveAttribute('aria-pressed', 'true');
// Selecting and the bulk bar work on tiles.
await userEvent.click(screen.getByRole('checkbox', { name: 'zomer.jpg' }));
expect(await screen.findByTestId('bulk-count')).toHaveTextContent('1 foto geselecteerd');
// The filter works on tiles.
await userEvent.click(screen.getByTestId('filter-unused'));
expect(within(screen.getByTestId('photo-items')).getAllByRole('listitem')).toHaveLength(1);
await userEvent.click(screen.getByTestId('filter-all'));
await userEvent.click(screen.getByTestId('layout-list'));
expect(screen.getByTestId('photo-items')).toHaveAttribute('data-layout', 'list');
expect(screen.getByTestId('layout-list')).toHaveAttribute('aria-pressed', 'true');
expect(window.localStorage.getItem('slp.media.layout')).toBe('list');
first.unmount();
// A later visit starts with the remembered layout, also in the trash view.
renderPage();
await screen.findByTestId('photo-selection-list');
expect(screen.getByTestId('photo-items')).toHaveAttribute('data-layout', 'list');
await userEvent.click(screen.getByTestId('view-trash'));
await screen.findByTestId('trash-note');
expect(screen.getByTestId('layout-list')).toBeInTheDocument();
});
it('shows an error when the library cannot be loaded', async () => {
server.use(http.get('*/media-library/photos', () => new HttpResponse(null, { status: 500 })));
renderPage();