File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,15 @@ import { HAS_STOPPED } from '../actions/hasStopped';
5
5
import { SET_VOLUME } from '../actions/setVolume' ;
6
6
import { SET_CURRENT_TIME } from '../actions/setCurrentTime' ;
7
7
import { SET_DURATION } from '../actions/setDuration' ;
8
+ import { SET_FULLSCREEN } from '../actions/setFullscreen' ;
8
9
9
10
const initialState = {
10
11
isPlaying : false ,
11
12
hasStopped : true ,
12
13
volume : 50 ,
13
14
currentTime : 0 ,
14
- duration : 0
15
+ duration : 0 ,
16
+ fullscreen : false
15
17
} ;
16
18
17
19
function setIsPlayingState ( isPlaying ) {
@@ -56,6 +58,12 @@ function setDurationState(duration) {
56
58
} ;
57
59
}
58
60
61
+ function setFullscreenState ( fullscreen ) {
62
+ return {
63
+ fullscreen : fullscreen
64
+ } ;
65
+ }
66
+
59
67
export function playbackReducer ( state = initialState , action ) {
60
68
switch ( action . type ) {
61
69
case IS_PLAYING :
@@ -68,6 +76,8 @@ export function playbackReducer(state = initialState, action) {
68
76
return Object . assign ( { } , state , setCurrentTimeState ( action . currentTime ) ) ;
69
77
case SET_DURATION :
70
78
return Object . assign ( { } , state , setDurationState ( action . duration ) ) ;
79
+ case SET_FULLSCREEN :
80
+ return Object . assign ( { } , state , setFullscreenState ( action . fullscreen ) ) ;
71
81
default :
72
82
return state ;
73
83
}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { HAS_STOPPED } from '../../app/actions/hasStopped';
6
6
import { SET_VOLUME } from '../../app/actions/setVolume' ;
7
7
import { SET_CURRENT_TIME } from '../../app/actions/setCurrentTime' ;
8
8
import { SET_DURATION } from '../../app/actions/setDuration' ;
9
+ import { SET_FULLSCREEN } from '../../app/actions/setFullscreen' ;
9
10
import { playbackReducer } from '../../app/reducers/playback' ;
10
11
11
12
describe ( 'playbackState' , ( ) => {
@@ -103,4 +104,19 @@ describe('playbackState', () => {
103
104
assert . strictEqual ( state . duration , 75 ) ;
104
105
} ) ;
105
106
} ) ;
107
+
108
+ describe ( 'fullscreen property' , ( ) => {
109
+ it ( 'defaults to false' , ( ) => {
110
+ assert . strictEqual ( playbackReducer ( undefined , '' ) . fullscreen , false ) ;
111
+ } ) ;
112
+
113
+ it ( 'sets {fullscreen: true} when action.fullscreen is true' , ( ) => {
114
+ const state = playbackReducer ( undefined , {
115
+ type : SET_FULLSCREEN ,
116
+ fullscreen : true
117
+ } ) ;
118
+
119
+ assert . strictEqual ( state . fullscreen , true ) ;
120
+ } ) ;
121
+ } ) ;
106
122
} ) ;
You can’t perform that action at this time.
0 commit comments