From 6abb5f1449b582f50796c71bbf20d8e4aac2f4de Mon Sep 17 00:00:00 2001 From: Simon Fondrie-Teitler Date: Thu, 18 May 2017 23:20:16 -0400 Subject: [refactor] refactor and add tests for Center and Confirmation As a couple of initial, example tests, Center and Confirmation were refactored and tests were set up and added with mocha, enzyme and chai. Spinner was also refactored. --- ui/app/components/confirmation.js | 68 ++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 33 deletions(-) (limited to 'ui/app/components/confirmation.js') diff --git a/ui/app/components/confirmation.js b/ui/app/components/confirmation.js index 6918616..deceb47 100644 --- a/ui/app/components/confirmation.js +++ b/ui/app/components/confirmation.js @@ -3,41 +3,43 @@ // import React from 'react' -import {Button, ButtonGroup, ButtonToolbar, Glyphicon, Modal} - from 'react-bootstrap' +import {Button, ButtonToolbar, Modal} from 'react-bootstrap' +import PropTypes from 'prop-types' -export default class Confirmation extends React.Component { +const Confirmation = props => ( + + + + {props.title} + + + + + + + + + +) - static get defaultProps() {return{ - title: "Are you sure?", - onCancel: null, - onAccept: null, - acceptStr: 'Accept', - cancelStr: 'Cancel' - }} - - constructor(props) { - super(props) - } +Confirmation.defaultProps = { + title: "Are you sure?", + onCancel: null, + onAccept: null, + acceptStr: 'Accept', + cancelStr: 'Cancel' +} - render() { - return ( - - - {this.props.title} - - - - - - - - - ) - } +Confirmation.propTypes = { + className: PropTypes.string, + onCancel: PropTypes.func.isRequired, + onAccept: PropTypes.func.isRequired, + acceptStr: PropTypes.string, + cancelStr: PropTypes.string } +export default Confirmation -- cgit v1.2.3