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/center.js | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) (limited to 'ui/app/components/center.js') diff --git a/ui/app/components/center.js b/ui/app/components/center.js index 5e47d0cc..e7e074af 100644 --- a/ui/app/components/center.js +++ b/ui/app/components/center.js @@ -3,38 +3,27 @@ // import React from 'react' +import PropTypes from 'prop-types' -class Center extends React.Component { +const Center = props => ( +
+
+ {props.children} +
+
+) - static get defaultProps() {return{ - width: null, - direction: 'both', - }} - - constructor(props) { - super(props) - } - - render() { - let style = null - if (this.props.width) { - style = {width: this.props.width + 'px'} - } - let className = "center-container center-" + this.props.direction - return ( -
-
- {this.props.children} -
-
- ) - } +Center.defaultProps = { + width: null, + direction: 'both' } Center.propTypes = { - children: React.PropTypes.oneOfType([ - React.PropTypes.element, - React.PropTypes.arrayOf(React.PropTypes.element) + children: PropTypes.oneOfType([ + PropTypes.element, + PropTypes.arrayOf( + PropTypes.element + ) ]) } -- cgit v1.2.3