Files
pipu-music/apps/web/src/test/setup.ts
T
mrleo1nidandClaude Opus 5.5 eaedd1fc62
ci / contract / contract (сгенерированный код совпадает с openapi.yaml) (push) Successful in 41s
ci / mobile / mobile (Metro-бандл Android) (push) Successful in 1m13s
ci / ts / ts (packages + web) (push) Successful in 1m14s
ci / api / api (push) Successful in 36s
feat(web): My Wave button, mood picker and endless wave playback (M4)
- 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>
2026-10-20 12:29:38 +03:00

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 });