mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 06:25:41 +00:00
test(ui): MiniPlayer + FullscreenPlayer (§4.5 regression) (Phase F5c) (#548)
MiniPlayer.test.tsx (4): mounts without throwing, renders the
always-present titlebar controls (Pin + Open main window — Close is
Linux-only and lives on the manual smoke list per pick 4a), click on
Open main window / Close does not throw, clicking the Pin button
flips the alwaysOnTop label between "Unpin" and "Pin on top". Bridge
contract (mini:ready / mini:sync, geometry persistence) deferred to
B-tier phase B5 -- jsdom does not model two webviews.
FullscreenPlayer.test.tsx (9): renders the labelled Fullscreen Player
dialog + Close Fullscreen control. Control wiring: Close calls
onClose, Stop calls stop, Previous calls previous, Next calls next,
Repeat cycles via toggleRepeat.
§4.5 of the v2 plan -- useCachedUrl(coverUrl, coverKey, false)
regression. Mocks the CachedImage module so the call args are
observable. Pins:
- the 500 px cover-art call passes opt=false (no fetchUrl fallback;
prevents double crossfade fetchUrl -> blobUrl);
- the 300 px art-box call passes opt=true (default behaviour).
A refactor that "tidies up" the useCachedUrl call sites would silently
regress the FS player cover; this test makes it loud.
Harness fix: vi.mock for @tauri-apps/api/event now returns an async
emit that resolves -- components chain .catch() on emit which crashed
on the bare vi.fn() return value during first-render useEffect.
Benefits any future component test that mounts something using emit.
Frontend suite: 399 -> 412 tests (+13). F5 (and Phases F0-F6) complete.
This commit is contained in:
committed by
GitHub
parent
2c38db6ea6
commit
377675ae94
+5
-2
@@ -89,8 +89,11 @@ vi.mock('@tauri-apps/api/core', () => ({
|
||||
|
||||
vi.mock('@tauri-apps/api/event', () => ({
|
||||
listen: vi.fn(),
|
||||
emit: vi.fn(),
|
||||
once: vi.fn(),
|
||||
// Components chain `.catch()` on emit; return a resolved Promise so the
|
||||
// chain doesn't throw "Cannot read properties of undefined (reading
|
||||
// 'catch')" inside a useEffect on first render.
|
||||
emit: vi.fn(async () => undefined),
|
||||
once: vi.fn(async () => () => {}),
|
||||
}));
|
||||
|
||||
// Linker for Tauri shell / dialog / store plugins — same idea. Extend as needed.
|
||||
|
||||
Reference in New Issue
Block a user