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
2c6f949
commit d01f0a0
Showing
12 changed files
with
169 additions
and
4 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.
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,5 @@ | ||
.calculator-container { | ||
background-color: var(--calculator-background-color); | ||
height: var(--calculator-height); | ||
width: var(--calculator-width); | ||
} |
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,17 @@ | ||
.display-container { | ||
align-items: center; | ||
background: var(--display-background-color); | ||
display: flex; | ||
height: var(--display-height); | ||
padding: 0 4%; | ||
width: var(--display-width); | ||
} | ||
|
||
.display-value { | ||
color: var(--display-text-color); | ||
font-size: var(--display-text-size); | ||
font-family: var(--main-font); | ||
font-weight: var(--display-text-weight); | ||
margin-left: auto; | ||
overflow: hidden; | ||
} |
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,9 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import './Display.css'; | ||
|
||
const Display = ({ displayValue }) => <div className="display-container"><p className="display-value">{displayValue}</p></div>; | ||
|
||
Display.propTypes = { displayValue: PropTypes.string.isRequired }; | ||
|
||
export default Display; |
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,20 @@ | ||
import {shallow} from 'enzyme'; | ||
import Display from './Display'; | ||
import React from 'react'; | ||
|
||
describe('Display', () => { | ||
let wrapper; | ||
|
||
beforeEach(() => wrapper = shallow(<Display displayValue={''} />)); | ||
|
||
it('should render a <div />', () => { | ||
expect(wrapper.find('div').length).toEqual(1); | ||
}); | ||
|
||
it('renders the value of displayValue', () => { | ||
wrapper.setProps({ displayValue: 'test' }); | ||
expect(wrapper.text()).toEqual('test'); | ||
}); | ||
|
||
it('should render correctly', () => expect(wrapper).toMatchSnapshot()); | ||
}); |
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,15 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const Keypad = ({ callOperator, numbers, operators, setOperator, updateDisplay }) => | ||
<div className="keypad-container" />; | ||
|
||
Keypad.propTypes = { | ||
callOperator: PropTypes.func.isRequired, | ||
numbers: PropTypes.array.isRequired, | ||
operators: PropTypes.array.isRequired, | ||
setOperator: PropTypes.func.isRequired, | ||
updateDisplay: PropTypes.func.isRequired, | ||
} | ||
|
||
export default Keypad; |
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,23 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import Keypad from './Keypad'; | ||
|
||
describe('Keypad', () => { | ||
let wrapper; | ||
|
||
beforeEach(() => { | ||
wrapper = shallow( | ||
<Keypad | ||
callOperator={jest.fn()} | ||
numbers={[]} | ||
operators={[]} | ||
setOperator={jest.fn()} | ||
updateDisplay={jest.fn()} | ||
/> | ||
); | ||
}); | ||
|
||
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