increasing test coverage to 20 percent
[aai/sparky-fe.git] / src / generic-components / input / ToggleInput.jsx
index 49b0376..f68758a 100644 (file)
@@ -23,54 +23,54 @@ import { PropTypes } from 'prop-types';
 
 export default
 class ToggleInput extends React.Component {
-               
-               static propTypes = {
-                               label: PropTypes.node,
-                               value: PropTypes.bool,
-                               onChange: PropTypes.func,
-                               disabled: PropTypes.bool
-               }
-               
-               static defaultProps = {
-                               value: false,
-                               label: ''
-               }
-               
-               state = {
-                               value: this.props.value
-               }
-               
-               status() {
-                               return this.state.value ? 'on' : 'off';
-               }
-               
-               render() {
-                               let {label, disabled} = this.props;
-                               let checked = this.status() === 'on';
-                               return (
-                                               <div className='toggle-input-wrapper form-group'
-                                                    onClick={!disabled && this.click}>
-                                                               <div className='toggle-input-label'>{label}</div>
-                                                               <div className='toggle-switch'>
-                                                                               <input className='toggle toggle-round-flat' type='checkbox'
-                                                                                      checked={checked} readOnly/>
-                                                                               <label></label>
-                                                               </div>
-                                               </div>
-                               );
-               }
-               
-               click = () => {
-                               let value = !this.state.value;
-                               this.setState({value});
-                               
-                               let onChange = this.props.onChange;
-                               if (onChange) {
-                                               onChange(value);
-                               }
-               }
-               
-               getValue() {
-                               return this.state.value;
-               }
+
+  static propTypes = {
+    label: PropTypes.node,
+    value: PropTypes.bool,
+    onChange: PropTypes.func,
+    disabled: PropTypes.bool
+  }
+
+  static defaultProps = {
+    value: false,
+    label: ''
+  }
+
+  state = {
+    value: this.props.value
+  }
+
+  status() {
+    return this.state.value ? 'on' : 'off';
+  }
+
+  render() {
+    let {label, disabled} = this.props;
+    let checked = this.status() === 'on';
+    return (
+      <div className='toggle-input-wrapper form-group'
+           onClick={!disabled && this.click}>
+        <div className='toggle-input-label'>{label}</div>
+        <div className='toggle-switch'>
+          <input className='toggle toggle-round-flat' type='checkbox'
+                 checked={checked} readOnly/>
+          <label></label>
+        </div>
+      </div>
+    );
+  }
+
+  click = () => {
+    let value = !this.state.value;
+    this.setState({value});
+
+    let onChange = this.props.onChange;
+    if (onChange) {
+      onChange(value);
+    }
+  }
+
+  getValue() {
+    return this.state.value;
+  }
 }