- bar at the bottom of every page with cover, artists, controls, seek and time - full-screen player in a dialog: big cover, bar-style seek control, up next, focus kept inside, Escape closes - Space plays and pauses unless the key belongs to a field, a button or a link - songs list row, seek control and time formatting - jumpTo in the queue store for a click on an upcoming track
19 lines
741 B
TypeScript
19 lines
741 B
TypeScript
import '@testing-library/jest-dom/vitest'
|
|
import { cleanup } from '@testing-library/react'
|
|
import { afterEach, vi } from 'vitest'
|
|
|
|
// jsdom has no media playback: its play, pause and load only print "not implemented".
|
|
Object.defineProperty(window.HTMLMediaElement.prototype, 'play', { configurable: true, value: () => Promise.resolve() })
|
|
Object.defineProperty(window.HTMLMediaElement.prototype, 'pause', { configurable: true, value: () => {} })
|
|
Object.defineProperty(window.HTMLMediaElement.prototype, 'load', { configurable: true, value: () => {} })
|
|
|
|
afterEach(() => {
|
|
cleanup()
|
|
vi.unstubAllGlobals()
|
|
vi.useRealTimers()
|
|
try {
|
|
localStorage.clear()
|
|
} catch {
|
|
// storage may be unavailable in a test that replaced it
|
|
}
|
|
})
|