import { describe, expect, it } from 'vitest'; import { renderToStaticMarkup } from 'react-dom/server'; import { PlayerControls } from './PlayerControls'; const noop = () => {}; function render(over: Partial[0]> = {}) { return renderToStaticMarkup( ); } describe('PlayerControls', () => { it('shows transport, times and volume when controllable', () => { const html = render(); expect(html).toContain('0:30'); expect(html).toContain('2:00'); expect(html).toContain('Back 10 seconds'); expect(html).toContain('Forward 10 seconds'); expect(html).not.toContain('disabled'); }); it('disables transport when canControl is false', () => { const html = render({ canControl: false }); // Play/pause + the two ±10s buttons are disabled… expect(html.match(/disabled/g)?.length).toBe(3); // …but the volume bar (local) is still rendered. expect(html).toContain('50%'); }); it('hides seek buttons and shows LIVE for live sources', () => { const html = render({ live: true }); expect(html).not.toContain('Back 10 seconds'); expect(html).toContain('LIVE'); }); it('renders skip only when onSkip is given', () => { expect(render()).not.toContain('Play next'); expect(render({ onSkip: noop })).toContain('Play next'); }); it('hides the local row when showLocal is false', () => { expect(render({ showLocal: false })).not.toContain('Vol'); }); it('renders the unified settings slot in the local row', () => { expect(render({ settings: })).toContain( 'Settings gear' ); }); });