Skip to content

Commit 1ce918b

Browse files
committed
Making the value prop required in the volume component
1 parent 899c229 commit 1ce918b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

app/components/Volume.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Volume.defaultProps = {
2222

2323
Volume.propTypes = {
2424
onChange: React.PropTypes.func.isRequired,
25-
value: React.PropTypes.number,
25+
value: React.PropTypes.number.isRequired,
2626
min: React.PropTypes.number,
2727
max: React.PropTypes.number,
2828
step: React.PropTypes.number

test/components/Volume.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ import sinon from 'sinon';
77

88
import Volume from '../../app/components/Volume.jsx';
99

10+
const VALUE = 5;
11+
1012
describe('<Volume />', () => {
1113
it('renders the volume control with the default values', () => {
12-
const value = 5;
1314
const wrapper = shallow(
14-
<Volume value={value} onChange={() => {}} />
15+
<Volume value={VALUE} onChange={() => {}} />
1516
);
1617
const input = wrapper.find('input');
1718

@@ -21,9 +22,8 @@ describe('<Volume />', () => {
2122
});
2223

2324
it('renders the volume control with the correct value', () => {
24-
const value = 5;
2525
const wrapper = shallow(
26-
<Volume value={value} onChange={() => {}} />
26+
<Volume value={VALUE} onChange={() => {}} />
2727
);
2828

2929
assert.equal(wrapper.find('input').prop('value'), 5);
@@ -32,7 +32,7 @@ describe('<Volume />', () => {
3232
it('calls the onChange function', () => {
3333
const onChangeSpy = sinon.spy();
3434
const wrapper = shallow(
35-
<Volume onChange={onChangeSpy} />
35+
<Volume value={VALUE} onChange={onChangeSpy} />
3636
);
3737
wrapper.find('input').simulate('change');
3838
assert.equal(onChangeSpy.calledOnce, true);

0 commit comments

Comments
 (0)