forked from calebpollman/react-calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
evelyn.graumann
committed
Jan 23, 2020
1 parent
114a54a
commit 2c6f949
Showing
12 changed files
with
2,783 additions
and
1,422 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.app-container { | ||
height: 100vh; | ||
width: 100vw; | ||
align-items: center; | ||
display: flex; | ||
justify-content: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from 'react'; | ||
import './App.css'; | ||
import Calculator from "../Calculator/Calculator"; | ||
|
||
const App = () => <div className="app-container"><Calculator/></div>; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import App from './App'; | ||
import Calculator from "../Calculator/Calculator"; | ||
|
||
describe('App', () => { | ||
let wrapper; | ||
|
||
beforeEach(() => wrapper = shallow(<App />)); | ||
|
||
it('should render a <div />', () => { | ||
expect(wrapper.find('div').length).toEqual(1); | ||
}); | ||
|
||
it('should render the Calculator Component', () => { | ||
expect(wrapper.containsMatchingElement(<Calculator />)).toEqual(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React, { Component } from 'react'; | ||
|
||
class Calculator extends Component { | ||
state = { | ||
// value to be displayed in <Display /> | ||
displayValue: '0', | ||
// values to be displayed in number <Keys /> | ||
numbers: [], | ||
// values to be displayed in operator <Keys /> | ||
operators: [], | ||
// operator selected for math operation | ||
selectedOperator: '', | ||
// stored value to use for math operation | ||
storedValue: '', | ||
} | ||
|
||
callOperator = () => { | ||
console.log('call operation'); | ||
} | ||
|
||
setOperator = () => { | ||
console.log('set operation'); | ||
} | ||
|
||
updateDisplay = () => { | ||
console.log('update display'); | ||
} | ||
|
||
render = () => { | ||
return ( | ||
<div className="calculator-container" /> | ||
); | ||
} | ||
} | ||
|
||
export default Calculator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import Calculator from './Calculator'; | ||
|
||
describe('Calculator', () => { | ||
let wrapper; | ||
|
||
beforeEach(() => wrapper = shallow(<Calculator />)); | ||
|
||
it('should render a <div />', () => { | ||
expect(wrapper.find('div').length).toEqual(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
app variables | ||
*/ | ||
|
||
:root { | ||
/* font */ | ||
--main-font: 'Orbitron', sans-serif; | ||
} | ||
|
||
/* | ||
app CSS reset | ||
*/ | ||
|
||
body, div, p { | ||
margin: 0; | ||
padding: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import './index.css'; | ||
import App from './components/App/App'; | ||
|
||
ReactDOM.render(<div>Hello World!</div>, document.getElementById('root')); | ||
ReactDOM.render(<App />, document.getElementById('root')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { configure } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
|
||
configure({ adapter: new Adapter() }); |