2.5 KiB
2.5 KiB
QA: Media page size memory (SPA)
Automated (Vitest + Vue Test Utils, task test:web)
Add web/src/views/__tests__/MediaPageSizeMemory.spec.ts, mirroring ArticlesPageSizeMemory.spec.ts and ActivityPageSizeMemory.spec.ts: stub localStorage per test (a Storage fake, plus variants whose getItem or setItem throws, and undefined), use the /v1/media/ mock of mediaTestKit.ts that honours page and size, and a real router. Extend web/src/lib/__tests__/pageSizeMemory.spec.ts for MEDIA_PAGE_SIZE_KEY.
- Choose a size table (5, 25, 50, 100) with nothing stored: stored value per the table and URLs
/media?size=5,/media,/media?size=50,/media?size=100. - Stored 5, open
/media: requestsize=5, select reads "5 per page", URL replaced (not pushed) by/media?size=5. - Leave and come back (navigate to
/then/media):size=5. - Reload on
/media?size=5and on/mediawith a fresh mount:size=5. - Stored 50: Next, "Unused" tab, "Largest" sort, list view and search "wall" each carry
size=50; the stored value stays "50". - Choose 100 after 5: stored "100", next visit
size=100. Choose 25 after 5: stored "25", URL stays/media. - Explicit
?size=100with stored 5: requestsize=100, stored still "5", later visitsize=5. ?page=3with stored 5: requestpage=3&size=5, URL replaced by/media?page=3&size=5.- Invalid stored table (
10,abc,0,-5,25.5, empty): requestsize=25, URL/media. - Invalid URL
?size=10with stored 5: requestsize=25, URL/media, stored still "5". - Unavailable storage table (throws on getItem, throws on setItem, undefined): page renders, no error,
size=25, then choosing 50 sendssize=50and URL/media?size=50. - Logout and login keeps the key (clear the auth store only; storage untouched), then
/mediasendssize=5. - Separate keys: articles 50, activity 100, media 5 -> the three views send 50, 100 and 5.
- Duplicates tab: stored 5 -> requests carry
size=100, stored unchanged, returning to All sendssize=5. - Unit test of the lib:
readStoredPageSize,storePageSizeandresolvePageSizewith the media key and the valid sizes 5/25/50/100.
No Visual part: no visual or design change.
Manual verification
- In a real browser (
task dev): choose "5 per page", refresh, close and reopen the tab, confirm the select and the URL; in DevTools confirm onlyrenewcms-page-size-mediachanged. - Block storage (private mode or disabled site data) and confirm the page still works.