Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd80ccc2

Browse files
committed
write tests and docs for window module
1 parenta4fd5de commitd80ccc2

File tree

4 files changed

+35
-29
lines changed

4 files changed

+35
-29
lines changed

‎src/modules/window/Quit/index.tsx

Lines changed: 0 additions & 29 deletions
This file was deleted.

‎src/modules/window/actions.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
import{QUIT,WINDOW_TOGGLE}from'./types';
22

3+
/**
4+
* Toggle window open action
5+
*@returns Action
6+
*/
37
exportfunctionwindowToggle():Action{
48
return{type:WINDOW_TOGGLE};
59
}
610

11+
/**
12+
* Toggle window closed action
13+
*@returns Action
14+
*/
715
exportfunctionquit():Action{
816
return{type:QUIT};
917
}

‎src/modules/window/reducer.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
importreducerfrom'./reducer';
2+
3+
describe('window reducer',()=>{
4+
5+
it('should initialize false',()=>{
6+
constaction={type:'null'};
7+
expect(reducer(undefined,action)).toBe(false);
8+
});
9+
10+
it('should set to false on QUIT',()=>{
11+
constaction={type:'QUIT'};
12+
expect(reducer(true,action)).toBe(false);
13+
});
14+
15+
it('should toggle the WINDOW_TOGGLE',()=>{
16+
constaction={type:'WINDOW_TOGGLE'};
17+
expect(reducer(false,action)).toBe(true);
18+
expect(reducer(true,action)).toBe(false);
19+
});
20+
21+
});

‎src/modules/window/reducer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import{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+
*/
39
exportdefaultfunctionwindowReducer(
410
open=false,action:Action
511
):boolean{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp