Skip to content

Commit 1c4d091

Browse files
authored
Merge pull request #59 from jzuniga206/native
Added Jest tests for some left container reducers
2 parents d2f02dd + 1767af2 commit 1c4d091

File tree

6 files changed

+213
-211
lines changed

6 files changed

+213
-211
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"build": "cross-env NODE_ENV=production webpack --config webpack.config.production.js",
7373
"build-bin": "electron-builder -mwl",
7474
"test": "cross-env NODE_ENV=test jest --verbose",
75+
"test:update-snap": "cross-env NODE_ENV=test jest --updateSnapshot",
7576
"test:clear": "cross-env NODE_ENV=test jest --clearCache",
7677
"test:update-snap": "cross-env NODE_ENV=test jest --updateSnapshot",
7778
"linter": "eslint src",

src/components/bottom/Props.tsx

Lines changed: 128 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -25,123 +25,6 @@ interface PropsPropsInt extends PropsInt {
2525
}): void;
2626
}
2727

28-
const styles = () => ({
29-
root: {
30-
display: 'flex',
31-
justifyContent: 'center',
32-
flexWrap: 'wrap'
33-
},
34-
chip: {
35-
color: '#eee',
36-
backgroundColor: '#333333'
37-
},
38-
column: {
39-
display: 'inline-flex',
40-
alignItems: 'baseline'
41-
},
42-
icon: {
43-
fontSize: '20px',
44-
color: '#eee',
45-
opacity: '0.7',
46-
transition: 'all .2s ease',
47-
48-
'&:hover': {
49-
color: 'red'
50-
}
51-
},
52-
cssLabel: {
53-
color: 'white',
54-
55-
'&$cssFocused': {
56-
color: 'green'
57-
}
58-
},
59-
propHeader: {
60-
fontSize: '35px',
61-
fontWeight: '900',
62-
marginLeft: '1rem',
63-
paddingTop: '10px'
64-
},
65-
dataTableHeader: {
66-
fontSize: '35px',
67-
fontWeight: '900',
68-
marginLeft: '22rem',
69-
marginTop: '15px',
70-
paddingTop: '10px'
71-
},
72-
cssFocused: {},
73-
input: {
74-
color: '#fff',
75-
marginBottom: '10px',
76-
width: '160px',
77-
backgroundColor: 'none',
78-
borderRadius: '5px',
79-
height: '40%',
80-
paddingLeft: '15px',
81-
paddingTop: '5px',
82-
paddingBottom: '5px',
83-
paddingRight: '10px',
84-
fontSize: '1.2rem',
85-
whiteSpace: 'nowrap',
86-
overflowX: 'hidden',
87-
textOverflow: 'ellipsis',
88-
border: '1px solid #33eb91'
89-
},
90-
inputLabel: {
91-
fontSize: '16px',
92-
zIndex: '20',
93-
color: '#fff',
94-
marginLeft: '10px'
95-
},
96-
select: {
97-
color: '#fff',
98-
marginBottom: '10px',
99-
width: '120px',
100-
backgroundColor: 'rgba(0, 0, 0, 0.3)',
101-
borderRadius: '5px',
102-
height: '40%',
103-
overflowWrap: 'break-word',
104-
paddingLeft: '15px',
105-
paddingTop: '5px',
106-
paddingBottom: '5px',
107-
fontSize: '1.2rem',
108-
border: '1px solid #33eb91'
109-
},
110-
selectLabel: {
111-
fontSize: '16px',
112-
zIndex: '20',
113-
color: '#fff',
114-
marginLeft: '10px'
115-
},
116-
addProp: {
117-
width: '15rem',
118-
marginLeft: '3rem',
119-
height: '4rem',
120-
transition: 'all 0.1s ease-out',
121-
border: '2px solid #33eb91',
122-
background: 'transparent',
123-
color: '#fff',
124-
'&:hover': {
125-
transform: 'scale(1.1)',
126-
fontSize: '1.2rem',
127-
backgroundColor: '#33eb91',
128-
color: '#006400'
129-
}
130-
},
131-
dataTable: {
132-
border: '1px solid red',
133-
backgroundColor: 'red',
134-
width: '60%'
135-
},
136-
light: {
137-
color: '#eee'
138-
},
139-
avatar: {
140-
color: '#eee',
141-
fontSize: '10px'
142-
}
143-
});
144-
14528
const mapDispatchToProps = (dispatch: any) => ({
14629
addProp: (prop: PropInt) => dispatch(addProp(prop)),
14730
deleteProp: (propId: number) => dispatch(deleteProp(propId)),
@@ -159,17 +42,14 @@ const mapStateToProps = (store: any) => ({
15942
focusChild: store.workspace.focusChild
16043
});
16144

162-
// available types for select drop-down for button types
45+
// available TypeScript types for select drop-down next to Props input
16346
const availablePropTypes = {
16447
string: 'STR',
16548
number: 'NUM',
16649
object: 'OBJ',
16750
array: 'ARR',
16851
boolean: 'BOOL',
16952
function: 'FUNC',
170-
// symbol: 'SYM',
171-
// node: 'NODE',
172-
// element: 'ELEM',
17353
any: 'ANY',
17454
tuple: 'TUP',
17555
enum: 'ENUM'
@@ -228,7 +108,7 @@ class Props extends Component<PropsPropsInt, StateInt> {
228108
// function that handles the addition of props to a given componnent
229109
// added regex to strip usr input from non alpha numeric properties
230110
// presence of these characters crashes the app and should not be a valid input anyways
231-
handleAddProp = (event: MouseEvent) => {
111+
handleAddProp = (event: React.ChangeEvent<HTMLFormElement>) => {
232112
event.preventDefault();
233113

234114
// destructuring from local state
@@ -286,7 +166,10 @@ class Props extends Component<PropsPropsInt, StateInt> {
286166
}));
287167

288168
return (
289-
<div className={'htmlattr'}>
169+
<div
170+
className={'htmlattr'}
171+
style={{ overflowY: 'auto', height: '85%', marginTop: '1rem' }}
172+
>
290173
{' '}
291174
{/* if no focus component in state, then render message */}
292175
{Object.keys(focusComponent).length < 1 ? (
@@ -333,7 +216,6 @@ class Props extends Component<PropsPropsInt, StateInt> {
333216
<FormControl>
334217
<TextField
335218
type="text"
336-
// native commented out due to overload error with material
337219
id="propVariable"
338220
label="Prop"
339221
margin="none"
@@ -355,22 +237,6 @@ class Props extends Component<PropsPropsInt, StateInt> {
355237
/>
356238
</FormControl>
357239
</Grid>
358-
{/* code for */}
359-
{/* <Grid item xs={6}>
360-
<TextField
361-
id='propValue'
362-
label='Value'
363-
margin='normal'
364-
onChange={this.handleChange}
365-
InputProps={{
366-
className: classes.input,
367-
}}
368-
InputLabelProps={{
369-
className: classes.input,
370-
}}
371-
value={this.state.propValue}
372-
/>
373-
</Grid> */}
374240
<Grid item xs={6}>
375241
<FormControl required>
376242
<InputLabel
@@ -429,10 +295,12 @@ class Props extends Component<PropsPropsInt, StateInt> {
429295
item
430296
xs={8}
431297
style={{
432-
height: '17rem',
433-
overflow: 'scroll',
298+
height: '100%',
299+
overflowY: 'auto',
300+
overflowX: 'auto',
434301
marginTop: '1rem',
435-
paddingBottom: '1rem',
302+
// paddingBottom: '1rem',
303+
marginLeft: '6rem',
436304
paddingTop: '0'
437305
}}
438306
>
@@ -455,6 +323,123 @@ class Props extends Component<PropsPropsInt, StateInt> {
455323
}
456324
}
457325

326+
const styles = () => ({
327+
root: {
328+
display: 'flex',
329+
justifyContent: 'center',
330+
flexWrap: 'wrap'
331+
},
332+
chip: {
333+
color: '#eee',
334+
backgroundColor: '#333333'
335+
},
336+
column: {
337+
display: 'inline-flex',
338+
alignItems: 'baseline'
339+
},
340+
icon: {
341+
fontSize: '20px',
342+
color: '#eee',
343+
opacity: '0.7',
344+
transition: 'all .2s ease',
345+
346+
'&:hover': {
347+
color: 'red'
348+
}
349+
},
350+
cssLabel: {
351+
color: 'white',
352+
353+
'&$cssFocused': {
354+
color: 'green'
355+
}
356+
},
357+
propHeader: {
358+
fontSize: '35px',
359+
fontWeight: '900',
360+
marginLeft: '1rem',
361+
paddingTop: '10px'
362+
},
363+
dataTableHeader: {
364+
fontSize: '35px',
365+
fontWeight: '900',
366+
marginLeft: '22rem',
367+
marginTop: '15px',
368+
paddingTop: '10px'
369+
},
370+
cssFocused: {},
371+
input: {
372+
color: '#fff',
373+
marginBottom: '10px',
374+
width: '160px',
375+
backgroundColor: 'none',
376+
borderRadius: '5px',
377+
height: '40%',
378+
paddingLeft: '15px',
379+
paddingTop: '5px',
380+
paddingBottom: '5px',
381+
paddingRight: '10px',
382+
fontSize: '1.2rem',
383+
whiteSpace: 'nowrap',
384+
overflowX: 'hidden',
385+
textOverflow: 'ellipsis',
386+
border: '1px solid #33eb91'
387+
},
388+
inputLabel: {
389+
fontSize: '16px',
390+
zIndex: '20',
391+
color: '#fff',
392+
marginLeft: '10px'
393+
},
394+
select: {
395+
color: '#fff',
396+
marginBottom: '10px',
397+
width: '120px',
398+
backgroundColor: 'rgba(0, 0, 0, 0.3)',
399+
borderRadius: '5px',
400+
height: '40%',
401+
overflowWrap: 'break-word',
402+
paddingLeft: '15px',
403+
paddingTop: '5px',
404+
paddingBottom: '5px',
405+
fontSize: '1.2rem',
406+
border: '1px solid #33eb91'
407+
},
408+
selectLabel: {
409+
fontSize: '16px',
410+
zIndex: '20',
411+
color: '#fff',
412+
marginLeft: '10px'
413+
},
414+
addProp: {
415+
width: '15rem',
416+
marginLeft: '3rem',
417+
height: '4rem',
418+
transition: 'all 0.1s ease-out',
419+
border: '2px solid #33eb91',
420+
background: 'transparent',
421+
color: '#fff',
422+
'&:hover': {
423+
transform: 'scale(1.1)',
424+
fontSize: '1.2rem',
425+
backgroundColor: '#33eb91',
426+
color: '#006400'
427+
}
428+
},
429+
dataTable: {
430+
border: '1px solid red',
431+
backgroundColor: 'red',
432+
width: '60%'
433+
},
434+
light: {
435+
color: '#eee'
436+
},
437+
avatar: {
438+
color: '#eee',
439+
fontSize: '10px'
440+
}
441+
});
442+
458443
export default connect(
459444
mapStateToProps,
460445
mapDispatchToProps

0 commit comments

Comments
 (0)