From 7225d842164dc01db5977f3d3a896004ee0b3256 Mon Sep 17 00:00:00 2001 From: Jeason Centaure Date: Fri, 26 Jan 2018 15:10:38 +0100 Subject: [PATCH] feat: NextButton component --- components/NextButton.js | 10 ++++++++++ components/NextButton.test.js | 17 +++++++++++++++++ stories/index.js | 4 ++++ 3 files changed, 31 insertions(+) create mode 100644 components/NextButton.js create mode 100644 components/NextButton.test.js 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', () => )