- WaveButton: TypeScript port of the prototype's canvas animation (orb and liquid), breathing at rest, pulsing to the track's BPM and energy in the cover palette, following the cursor, pressing with a spring; reduced motion and hidden tabs slow or stop it - home: the wave in the centre with activity and mood chips; changing them while playing rebuilds the upcoming tracks without stopping - player wave mode: asks for the next batch when two tracks are left, sends complete / skip / early skip / like / dislike as feedback and refreshes the queue right after a reaction or an early skip - tracks expose bpm, energy and loudness once analysed; library page shows analysis progress and 7-day wave metrics; wave style setting Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
23 lines
1.1 KiB
TypeScript
23 lines
1.1 KiB
TypeScript
import '@testing-library/jest-dom/vitest';
|
|
|
|
// jsdom не умеет играть звук: play/pause только переключают флаг и шлют события, как браузер.
|
|
Object.defineProperty(HTMLMediaElement.prototype, 'play', {
|
|
configurable: true,
|
|
value(this: HTMLMediaElement) {
|
|
Object.defineProperty(this, 'paused', { configurable: true, value: false });
|
|
this.dispatchEvent(new Event('playing'));
|
|
return Promise.resolve();
|
|
},
|
|
});
|
|
Object.defineProperty(HTMLMediaElement.prototype, 'pause', {
|
|
configurable: true,
|
|
value(this: HTMLMediaElement) {
|
|
Object.defineProperty(this, 'paused', { configurable: true, value: true });
|
|
this.dispatchEvent(new Event('pause'));
|
|
},
|
|
});
|
|
Object.defineProperty(HTMLMediaElement.prototype, 'load', { configurable: true, value() {} });
|
|
|
|
// Canvas в jsdom нет: кнопка волны без контекста просто не рисует (как в старых браузерах).
|
|
Object.defineProperty(HTMLCanvasElement.prototype, 'getContext', { configurable: true, value: () => null });
|