Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,25 @@ describe('usePlayerState', () => {
expect(nextState.unplayed).toBe(true);
});

it('is no longer unplayed after play action', () => {
it('is no longer unplayed after playing action', () => {
const {result} = renderHookInEntry(() => usePlayerState());
const [,actions] = result.current;
act(() => actions.play());
act(() => actions.playing());
const [nextState,] = result.current;

expect(nextState.unplayed).toBe(false);
});

it('stays unplayed after play action until playing', () => {
const {result} = renderHookInEntry(() => usePlayerState());
const [,actions] = result.current;
act(() => actions.play());
const [nextState,] = result.current;

expect(nextState.unplayed).toBe(true);
});

it('becomes unplayed again when video ends to make it return to its initial look', () => {
const {result} = renderHookInEntry(() => usePlayerState());
const [,actions] = result.current;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ export function playerStateReducer(state, action){
isLoading: true,
shouldPlay: true,
playFailed: false,
unplayed: false,
lastControlledVia: action.payload.via
};
case PLAYING:
return {
...state,
shouldPlay: true,
isPlaying: true,
unplayed: false,
userIdle: false
};
case PLAY_AND_FADE_IN:
Expand Down
Loading