diff --git a/components/NextButton.js b/components/NextButton.js new file mode 100644 index 0000000..0cd15e3 --- /dev/null +++ b/components/NextButton.js @@ -0,0 +1,10 @@ +import React from 'react' +import PropTypes from 'prop-types' + +const NextButton = ({ disabled }) => + +NextButton.propTypes = { + disabled: PropTypes.bool, +} + +export default NextButton diff --git a/components/NextButton.test.js b/components/NextButton.test.js new file mode 100644 index 0000000..3239c4c --- /dev/null +++ b/components/NextButton.test.js @@ -0,0 +1,17 @@ +import { shallow } from 'enzyme' +import React from 'react' +import NextButton from './NextButton' + +describe('#NextButton', () => { + it('should render a button that can be disabled', () => { + const wrapper = shallow( +
+ + +
, + ) + const buttons = wrapper.find('NextButton') + expect(buttons.at(0).props().disabled).toBe(true) + expect(buttons.at(1).props().disabled).toBeUndefined() + }) +}) diff --git a/stories/index.js b/stories/index.js index 505e5e1..1ce04fa 100644 --- a/stories/index.js +++ b/stories/index.js @@ -2,6 +2,7 @@ import React from 'react' import { storiesOf } from '@storybook/react' import ProgressBar from '../components/ProgressBar' import Timer from '../components/Timer' +import NextButton from '../components/NextButton' storiesOf('ProgressBar', module) .add('0/20', () => ) @@ -14,3 +15,6 @@ storiesOf('ProgressBar', module) .add('Red', () => ) storiesOf('Timer', module).add('Basic', () => ) +storiesOf('NextButton', module) + .add('disabled', () => ) + .add('not disabled', () => )