Files
reader/web/test/reader-speech-voices.test.ts
hectorqin 73f9eb6e20 feat(media): add isolated media libraries and playback
Support local and OpenList libraries, metadata, independent media navigation, themes, and audio/video playback. Preserve approved v2 prototypes and current documentation; archive superseded review artifacts and keep generated validation output outside version control.
2026-09-27 18:22:51 +08:00

17 lines
716 B
TypeScript

// @vitest-environment jsdom
import { expect, it, vi } from 'vitest';
import { ReaderScreen } from '../src/ui/reader-screen.tsx';
it('publishes asynchronous voice changes without reopening the existing settings panel', () => {
const context = {
voices: [], lastSpeechQueue: [], chrome: { tts: {} }, speechQueueIndex: () => 0,
patch: vi.fn(), setStatus: vi.fn(), view: null,
};
const voice = { id: 'zh', name: '中文', lang: 'zh-CN', default: true };
Reflect.apply(ReaderScreen.prototype['renderSpeechState'], context, [{
state: 'idle', voices: [voice], total: 0, index: -1, chunk: '', error: '',
}]);
expect(context.voices).toEqual([voice]);
expect(context.patch).toHaveBeenCalled();
});