Skip to content

Commit 545b8e1

Browse files
committed
update to react 16.6
1 parent 6f4a33b commit 545b8e1

File tree

12 files changed

+17271
-10524
lines changed

12 files changed

+17271
-10524
lines changed

package-lock.json

Lines changed: 17216 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"react": "^16.5.2",
7-
"react-dom": "^16.5.2"
6+
"react": "^16.6.0",
7+
"react-dom": "^16.6.0"
88
},
99
"devDependencies": {
1010
"enzyme": "^3.7.0",
1111
"enzyme-adapter-react-16": "^1.6.0",
12-
"react-scripts": "2.0.5",
13-
"react-test-renderer": "^16.5.2"
12+
"react-scripts": "2.1.0",
13+
"react-test-renderer": "^16.6.0"
1414
},
1515
"scripts": {
1616
"start": "react-scripts start",

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta name="theme-color" content="#000000">
77
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.png">
88
<link href="https://fonts.googleapis.com/css?family=Orbitron:400,700" rel="stylesheet">
9-
<title>Issa Calculator</title>
9+
<title>Calcutronic 5000</title>
1010
</head>
1111
<body>
1212
<noscript>

src/components/App/App.jsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ import React from 'react';
22
import Calculator from '../Calculator/Calculator';
33
import './App.css';
44

5-
const App = () => {
6-
return (
7-
<div className="app-container">
8-
<Calculator />
9-
</div>
10-
);
11-
}
5+
const App = () => (
6+
<div className="app-container">
7+
<Calculator />
8+
</div>
9+
);
1210

1311
export default App;

src/components/App/App.spec.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
import React from 'react';
2-
import {shallow} from 'enzyme';
2+
import { shallow } from 'enzyme';
33
import App from './App';
44
import Calculator from '../Calculator/Calculator';
55

66
describe('App', () => {
77
let wrapper;
8-
beforeEach(() => {
9-
wrapper = shallow(<App />);
10-
});
8+
beforeEach(() => wrapper = shallow(<App />));
119

12-
it('should render correctly', () => {
13-
expect(wrapper).toMatchSnapshot();
14-
});
15-
16-
it('should render a <div />', () => {
10+
it('should render correctly', () => expect(wrapper).toMatchSnapshot());
11+
12+
it('should render a <div />', () => {
1713
expect(wrapper.find('div').length).toEqual(1);
1814
});
1915

src/components/Calculator/Calculator.spec.js

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ import Keypad from '../Keypad/Keypad';
66

77
describe('Calculator', () => {
88
let wrapper;
9-
beforeEach(() => {
10-
wrapper = shallow(<Calculator />);
11-
});
9+
beforeEach(() => wrapper = shallow(<Calculator />));
1210

13-
it('should render correctly', () => {
14-
expect(wrapper).toMatchSnapshot();
15-
});
11+
it('should render correctly', () => expect(wrapper).toMatchSnapshot());
1612

1713
it('should render a <div />', () => {
1814
expect(wrapper.find('div').length).toEqual(1);
@@ -35,9 +31,7 @@ describe('Calculator', () => {
3531

3632
describe('updateDisplay', () => {
3733
let wrapper;
38-
beforeEach(() => {
39-
wrapper = shallow(<Calculator />);
40-
});
34+
beforeEach(() => wrapper = shallow(<Calculator />));
4135

4236
it('updates displayValue', () => {
4337
wrapper.instance().updateDisplay('5');
@@ -84,9 +78,7 @@ describe('updateDisplay', () => {
8478

8579
describe('setOperator', () => {
8680
let wrapper;
87-
beforeEach(() => {
88-
wrapper = shallow(<Calculator />);
89-
});
81+
beforeEach(() => wrapper = shallow(<Calculator />));
9082

9183
it('updates the value of selectedOperator', () => {
9284
wrapper.instance().setOperator('+');
@@ -118,9 +110,7 @@ describe('setOperator', () => {
118110

119111
describe('callOperator', () => {
120112
let wrapper;
121-
beforeEach(() => {
122-
wrapper = shallow(<Calculator />);
123-
});
113+
beforeEach(() => wrapper = shallow(<Calculator />));
124114

125115
it('updates displayValue to the sum of storedValue and displayValue', () => {
126116
wrapper.setState({ storedValue: '3' });
@@ -189,9 +179,7 @@ describe('callOperator', () => {
189179

190180
describe('mounted Calculator', () => {
191181
let wrapper;
192-
beforeEach(() => {
193-
wrapper = mount(<Calculator />);
194-
});
182+
beforeEach(() => wrapper = mount(<Calculator />));
195183

196184
it('calls updateDisplay when a number key is clicked', () => {
197185
const spy = jest.spyOn(wrapper.instance(), 'updateDisplay');

src/components/Display/Display.jsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import './Display.css';
44

5-
const Display = ({ displayValue }) => {
6-
return (
7-
<div className="display-container">
8-
<p className="display-value">
9-
{displayValue}
10-
</p>
11-
</div>
12-
)
13-
};
5+
const Display = ({ displayValue }) => (
6+
<div className="display-container">
7+
<p className="display-value">
8+
{displayValue}
9+
</p>
10+
</div>
11+
);
1412

1513
Display.propTypes = { displayValue: PropTypes.string.isRequired }
1614

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
import React from 'react';
2-
import {shallow} from 'enzyme';
2+
import { shallow } from 'enzyme';
33
import Display from './Display';
44

55
describe('Display', () => {
66
let wrapper;
7-
beforeEach(() => {
8-
wrapper = shallow(<Display displayValue={''} />)
9-
});
7+
beforeEach(() => wrapper = shallow(<Display displayValue={''} />));
8+
9+
it('should render correctly', () => expect(wrapper).toMatchSnapshot());
1010

11-
it('should render correctly', () => {
12-
expect(wrapper).toMatchSnapshot();
13-
});
14-
1511
it('should render a <div />', () => {
1612
expect(wrapper.find('div').length).toEqual(1);
1713
});
1814

1915
it('renders the value of displayValue', () => {
20-
wrapper.setProps({displayValue: 'test'});
16+
wrapper.setProps({ displayValue: 'test' });
2117
expect(wrapper.text()).toEqual('test');;
2218
});
2319
});

src/components/Key/Key.spec.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ describe('Key', () => {
1515
);
1616
});
1717

18-
it('should render correctly', () => {
19-
expect(wrapper).toMatchSnapshot();
20-
});
18+
it('should render correctly', () => expect(wrapper).toMatchSnapshot());
2119

2220
it('should render a <div />', () => {
2321
expect(wrapper.find('div').length).toEqual(1);

src/components/Keypad/Keypad.jsx

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,33 @@ import './Keypad.css';
77

88
const Keypad = ({ operators, callOperator, handleKeyPress, numbers, setOperator, updateDisplay }) => {
99

10-
numbers = numbers.map((number, iterator) => {
11-
return (
12-
<Key
13-
handleKeyPress={handleKeyPress}
14-
key={`${number}${iterator}`}
15-
keyType="number-key"
16-
keyValue={number}
17-
keyAction={updateDisplay}
18-
/>
19-
);
20-
});
10+
const numberKeys = numbers.map((number, iterator) => (
11+
<Key
12+
handleKeyPress={handleKeyPress}
13+
key={`${number}${iterator}`}
14+
keyType="number-key"
15+
keyValue={number}
16+
keyAction={updateDisplay}
17+
/>
18+
));
2119

22-
operators = operators.map((operator, iterator) => {
23-
return (
24-
<Key
25-
handleKeyPress={handleKeyPress}
26-
key={`${operator}${iterator}`}
27-
keyType="operator-key"
28-
keyValue={operator}
29-
keyAction={setOperator}
30-
/>
31-
);
32-
});
20+
const operatorKeys = operators.map((operator, iterator) => (
21+
<Key
22+
handleKeyPress={handleKeyPress}
23+
key={`${operator}${iterator}`}
24+
keyType="operator-key"
25+
keyValue={operator}
26+
keyAction={setOperator}
27+
/>
28+
));
3329

3430
return (
3531
<div className="keypad-container">
3632
<div className="numbers-container">
37-
{numbers}
33+
{numberKeys}
3834
</div>
3935
<div className="operators-container">
40-
{operators}
36+
{operatorKeys}
4137
</div>
4238
<div className="submit-container">
4339
<Key

0 commit comments

Comments
 (0)