mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 06:25:41 +00:00
test(ui): QueuePanel (§4.4 DnD regression) + PlayerBar (Phase F5b) (#547)
QueuePanel.test.tsx (8): empty-queue affordance, one row per queue track with matching data-queue-idx, track titles render. Toolbar exposes Shuffle queue / Save Playlist / Load Playlist / Copy queue share link / Clear via aria-label; Shuffle is disabled when the queue has fewer than 2 tracks. §4.4 of the v2 plan -- DnD architecture pin. Queue rows do NOT declare draggable=true (no HTML5 native drag); the source file has no dataTransfer.setData / dataTransfer.getData / onDragStart / onDrop JSX usage; no application/json MIME anywhere. The project's psy-drop custom event system sidesteps WebView2's text/plain-only restriction by avoiding HTML5 DnD entirely -- a refactor that re-introduces native DnD on the queue would silently break Windows. PlayerBar.test.tsx (9): renders the labelled "Music Player" region. Surfaces Previous Track / Play / Next Track / Repeat / Stop when a track is loaded. The middle control flips between "Play" and "Pause" based on isPlaying. Control wiring: clicking Play/Pause calls togglePlay, Previous calls previous, Next calls next, Repeat cycles off -> all -> one, Stop calls stop. The region landmark is still rendered when no track is loaded. Adds a generic scrollIntoView no-op stub in src/test/mocks/browser.ts -- jsdom does not implement it and QueuePanel's queueAutoScroll calls it on mount with auto-advance enabled. Benefits any future component test that touches scroll affordances. Frontend suite: 382 -> 399 tests (+17).
This commit is contained in:
committed by
GitHub
parent
fae615fdb8
commit
2c38db6ea6
@@ -100,6 +100,16 @@ export function installBrowserMocks(): void {
|
||||
URL.createObjectURL = createObjectUrlMock as unknown as typeof URL.createObjectURL;
|
||||
URL.revokeObjectURL = revokeObjectUrlMock as unknown as typeof URL.revokeObjectURL;
|
||||
}
|
||||
|
||||
// jsdom lacks scrollIntoView — components that auto-scroll the queue / lists
|
||||
// crash on mount without this stub.
|
||||
if (typeof Element !== 'undefined' && !('scrollIntoView' in Element.prototype)) {
|
||||
Object.defineProperty(Element.prototype, 'scrollIntoView', {
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: function scrollIntoView(_opts?: ScrollIntoViewOptions | boolean) { /* no-op */ },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function resetBrowserMocks(): void {
|
||||
|
||||
Reference in New Issue
Block a user