@@ -3,14 +3,7 @@ import { Draggable } from 'react-beautiful-dnd';
33import styles from './Thunk.module.scss' ;
44import { GlobalContext } from '../../../context/reducers/globalReducer' ;
55import { ReduxTestCaseContext } from '../../../context/reducers/reduxTestCaseReducer' ;
6- import {
7- deleteAsync ,
8- updateAsync ,
9- updateActionsFilePath ,
10- updateTypesFilePath ,
11- } from '../../../context/actions/reduxTestCaseActions' ;
12- import ToolTipAsync from '../../ToolTip/ToolTipAsync' ;
13- import SearchInput from '../../SearchInput/SearchInput' ;
6+ import { deleteAsync , updateAsync } from '../../../context/actions/reduxTestCaseActions' ;
147
158const closeIcon = require ( '../../../assets/images/close.png' ) ;
169const dragIcon = require ( '../../../assets/images/drag-vertical.png' ) ;
@@ -45,41 +38,96 @@ const Async = ({ async, index }) => {
4538 < img src = { dragIcon } alt = 'drag' />
4639 < h3 > Asynchronous Action Creator</ h3 >
4740 </ div >
41+ < div id = { styles . groupFlexbox } >
42+ < div id = { styles . labelInput } >
43+ < label htmlFor = 'it' > It should...</ label >
44+ < input
45+ type = 'text'
46+ name = 'it'
47+ placeholder = 'eg/ should return expected action'
48+ onChange = { ( e ) => handleChangeAsyncFields ( e , 'it' ) }
49+ />
50+ </ div >
51+ </ div >
4852
49- { /* <div id={styles.groupFlexbox}>
53+ < div id = { styles . groupFlexbox } >
5054 < div id = { styles . labelInput } >
51- <label htmlFor='actionsFile'>Import Actions From</label>
52- <SearchInput
53- options={Object.keys(filePathMap)}
54- dispatch={dispatchToReduxTestCase}
55- updateActionsFilePath={updateActionsFilePath}
56- id={async.id}
57- filePathMap={filePathMap}
55+ < label htmlFor = 'asyncFunction' > Thunk Action Creator</ label >
56+ < input
57+ type = 'text'
58+ name = 'asyncFunction'
59+ onChange = { ( e ) => handleChangeAsyncFields ( e , 'asyncFunction' ) }
5860 />
5961 </ div >
6062
6163 < div id = { styles . labelInput } >
62- <label htmlFor='typesFile'>Import Actions Types From</label>
63- <SearchInput
64- options={Object.keys(filePathMap)}
65- dispatch={dispatchToReduxTestCase}
66- updateTypesFilePath={updateTypesFilePath}
67- id={async.id}
68- filePathMap={filePathMap}
64+ < label htmlFor = 'actionType' > Action Type Of Expected Action</ label >
65+ < input
66+ type = 'text'
67+ id = 'actionType'
68+ onChange = { ( e ) => handleChangeAsyncFields ( e , 'actionType' ) }
69+ placeholder = 'e.g. ADD_TODO'
6970 />
7071 </ div >
71- </div> */ }
72+ </ div >
7273
7374 < div id = { styles . groupFlexbox } >
7475 < div id = { styles . labelInput } >
75- < label htmlFor = 'asyncFunction' > Async Function</ label >
76+ < label htmlFor = 'expectedArg' > argument 1</ label >
77+ < div id = { styles . inputFlexBox } >
78+ < input
79+ type = 'text'
80+ name = 'expectedArg'
81+ placeholder = 'e.g. response'
82+ onChange = { ( e ) => handleChangeAsyncFields ( e , 'expectedArg' ) }
83+ />
84+ </ div >
85+ </ div >
86+ < div id = { styles . dropdownWrapper } >
87+ < label htmlFor = 'responseType' > Type</ label >
88+ < div id = { styles . dropdownFlex } >
89+ < select
90+ id = 'responseType'
91+ value = { async . responseType }
92+ onChange = { ( e ) => handleChangeAsyncFields ( e , 'responseType' ) }
93+ >
94+ < option value = '' />
95+ < option value = 'word' > word</ option >
96+ < option value = 'words' > words</ option >
97+ < option value = 'number' > number</ option >
98+ < option value = 'arrayElement' > arrayElement</ option >
99+ < option value = 'objectElement' > objectElement</ option >
100+ </ select >
101+ </ div >
102+ </ div >
103+ < div id = { styles . labelInput } >
104+ < label htmlFor = 'payloadKey' > argument 2</ label >
76105 < input
77106 type = 'text'
78- name = 'asyncFunction'
79- onChange = { ( e ) => handleChangeAsyncFields ( e , 'asyncFunction' ) }
107+ id = 'payloadKey'
108+ onChange = { ( e ) => handleChangeAsyncFields ( e , 'payloadKey' ) }
109+ placeholder = 'e.g. todo'
80110 />
81111 </ div >
112+ < div id = { styles . dropdownWrapper } >
113+ < label htmlFor = 'payloadType' > Type</ label >
114+ < div id = { styles . dropdownFlex } >
115+ < select
116+ id = 'payloadType'
117+ onChange = { ( e ) => handleChangeAsyncFields ( e , 'payloadType' ) }
118+ >
119+ < option value = '' />
120+ < option value = 'word' > word</ option >
121+ < option value = 'words' > words</ option >
122+ < option value = 'number' > number</ option >
123+ < option value = 'arrayElement' > arrayElement</ option >
124+ < option value = 'objectElement' > objectElement</ option >
125+ </ select >
126+ </ div >
127+ </ div >
128+ </ div >
82129
130+ < div id = { styles . groupFlexbox } >
83131 < div id = { styles . dropdownWrapper } >
84132 < label htmlFor = 'method' > Method</ label >
85133 < div id = { styles . dropdownFlex } >
@@ -109,75 +157,30 @@ const Async = ({ async, index }) => {
109157 </ div >
110158 </ div >
111159
112- < div id = { styles . groupFlexbox } >
113- < div id = { styles . labelInput } >
114- < label htmlFor = 'requestBody' > Request Body</ label >
115- < div id = { styles . inputFlexBox } >
116- < input
117- type = 'text'
118- name = 'requestBody'
119- onChange = { ( e ) => handleChangeAsyncFields ( e , 'requestBody' ) }
120- />
121- < span id = { styles . hastooltip } role = 'tooltip' >
122- < img src = { questionIcon } alt = 'help' />
123- < span id = { styles . tooltip } >
124- < ToolTipAsync toolTipType = { `object` } />
125- </ span >
126- </ span >
160+ { async . responseType === 'object' ? (
161+ < div id = { styles . groupFlexbox } >
162+ < div id = { styles . labelInput } >
163+ < label htmlFor = 'responseKey' > Response Key</ label >
164+ < div id = { styles . inputFlexBox } >
165+ < input
166+ type = 'text'
167+ name = 'responseKey'
168+ onChange = { ( e ) => handleChangeAsyncFields ( e , 'responseKey' ) }
169+ />
170+ </ div >
127171 </ div >
128- </ div >
129-
130- < div id = { styles . labelInput } >
131- < label htmlFor = 'store' > Store</ label >
132- < div id = { styles . inputFlexBox } >
133- < input
134- type = 'text'
135- name = 'store'
136- onChange = { ( e ) => handleChangeAsyncFields ( e , 'store' ) }
137- />
138- < span id = { styles . hastooltip } role = 'tooltip' >
139- < img src = { questionIcon } alt = 'help' />
140- < span id = { styles . tooltip } >
141- < ToolTipAsync toolTipType = { `object` } />
142- </ span >
143- </ span >
172+ < div id = { styles . labelInput } >
173+ < label htmlFor = 'responseValue' > Response Value</ label >
174+ < div id = { styles . inputFlexBox } >
175+ < input
176+ type = 'text'
177+ name = 'responseValue'
178+ onChange = { ( e ) => handleChangeAsyncFields ( e , 'responseValue' ) }
179+ />
180+ </ div >
144181 </ div >
145182 </ div >
146- </ div >
147-
148- < div id = { styles . groupFlexbox } >
149- < div id = { styles . dropdownWrapper } >
150- < label htmlFor = 'matcher' > Matcher</ label >
151- < div id = { styles . dropdownFlex } >
152- < select
153- id = 'matcher'
154- value = { async . matcher }
155- onChange = { ( e ) => handleChangeAsyncFields ( e , 'matcher' ) }
156- >
157- < option value = '' />
158- < option value = 'toEqual' > toEqual</ option >
159- < option value = 'toContainEqual' > toContainEqual</ option >
160- </ select >
161- </ div >
162- </ div >
163-
164- < div id = { styles . labelInput } >
165- < label htmlFor = 'expectedResponse' > Expected Response</ label >
166- < div id = { styles . inputFlexBox } >
167- < input
168- type = 'text'
169- name = 'expectedResponse'
170- onChange = { ( e ) => handleChangeAsyncFields ( e , 'expectedResponse' ) }
171- />
172- < span id = { styles . hastooltip } role = 'tooltip' >
173- < img src = { questionIcon } alt = 'help' />
174- < span id = { styles . tooltip } >
175- < ToolTipAsync toolTipType = { `expectedResponse` } />
176- </ span >
177- </ span >
178- </ div >
179- </ div >
180- </ div >
183+ ) : null }
181184 </ div >
182185 ) }
183186 </ Draggable >
0 commit comments