mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-11 02:46:16 -08:00
fix(player-controls): block toggles while stalled
This commit is contained in:
1 parent
7887d10828
commit
fec7190dd4
2 files changed
+18
-2
No files matched your search
@@ -39,8 +39,12 @@ export function createControlsViewModel(deps: ControlsViewModelDeps) {
|
||||
});
|
||||
const isPlaying = computed(() => state().status === 'playing');
|
||||
const canTogglePlay = computed(() => {
|
||||
const status = state().status;
|
||||
return status !== 'loading' && status !== 'error';
|
||||
const currentState = state();
|
||||
return (
|
||||
!currentState.stalled &&
|
||||
currentState.status !== 'loading' &&
|
||||
currentState.status !== 'error'
|
||||
);
|
||||
});
|
||||
|
||||
const hasAudioTracks = computed(
|
||||
|
||||
+12
@@ -357,6 +357,18 @@ describe('PlayerControlsComponent interactions', () => {
|
||||
expect(component.controlsAreVisible()).toBe(true);
|
||||
});
|
||||
|
||||
it('does not toggle playback from the surface while stalled', () => {
|
||||
const surface = document.createElement('div');
|
||||
fixture.componentRef.setInput('playerSurface', surface);
|
||||
setState({ status: 'playing', stalled: true });
|
||||
fixture.detectChanges();
|
||||
|
||||
surface.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
||||
jest.advanceTimersByTime(250);
|
||||
|
||||
expect(fake.commands.togglePlay).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('re-reveals hidden controls on reveal()', () => {
|
||||
jest.advanceTimersByTime(10000);
|
||||
fixture.detectChanges();
|
||||
|
||||
Reference in new issue
Block a user