File tree 4 files changed +35
-29
lines changed
4 files changed +35
-29
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
import { QUIT , WINDOW_TOGGLE } from './types' ;
2
2
3
+ /**
4
+ * Toggle window open action
5
+ * @returns Action
6
+ */
3
7
export function windowToggle ( ) : Action {
4
8
return { type : WINDOW_TOGGLE } ;
5
9
}
6
10
11
+ /**
12
+ * Toggle window closed action
13
+ * @returns Action
14
+ */
7
15
export function quit ( ) : Action {
8
16
return { type : QUIT } ;
9
17
}
Original file line number Diff line number Diff line change
1
+ import reducer from './reducer' ;
2
+
3
+ describe ( 'window reducer' , ( ) => {
4
+
5
+ it ( 'should initialize false' , ( ) => {
6
+ const action = { type : 'null' } ;
7
+ expect ( reducer ( undefined , action ) ) . toBe ( false ) ;
8
+ } ) ;
9
+
10
+ it ( 'should set to false on QUIT' , ( ) => {
11
+ const action = { type : 'QUIT' } ;
12
+ expect ( reducer ( true , action ) ) . toBe ( false ) ;
13
+ } ) ;
14
+
15
+ it ( 'should toggle the WINDOW_TOGGLE' , ( ) => {
16
+ const action = { type : 'WINDOW_TOGGLE' } ;
17
+ expect ( reducer ( false , action ) ) . toBe ( true ) ;
18
+ expect ( reducer ( true , action ) ) . toBe ( false ) ;
19
+ } ) ;
20
+
21
+ } ) ;
Original file line number Diff line number Diff line change 1
1
import { QUIT , WINDOW_TOGGLE } from './types' ;
2
2
3
+ /**
4
+ * Window open status reducer
5
+ * @param { } open=false
6
+ * @param {Action } action
7
+ * @returns boolean window open status
8
+ */
3
9
export default function windowReducer (
4
10
open = false , action : Action
5
11
) : boolean {
You can’t perform that action at this time.
0 commit comments