This repository was archived by the owner on Apr 8, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +35
-29
lines changed Expand file tree Collapse file tree 4 files changed +35
-29
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11import { QUIT , WINDOW_TOGGLE } from './types' ;
22
3+ /**
4+ * Toggle window open action
5+ * @returns Action
6+ */
37export function windowToggle ( ) : Action {
48 return { type : WINDOW_TOGGLE } ;
59}
610
11+ /**
12+ * Toggle window closed action
13+ * @returns Action
14+ */
715export function quit ( ) : Action {
816 return { type : QUIT } ;
917}
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 11import { QUIT , WINDOW_TOGGLE } from './types' ;
22
3+ /**
4+ * Window open status reducer
5+ * @param { } open=false
6+ * @param {Action } action
7+ * @returns boolean window open status
8+ */
39export default function windowReducer (
410 open = false , action : Action
511) : boolean {
You can’t perform that action at this time.
0 commit comments