diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-04-30 09:03:01 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-04-30 09:03:01 +0900 |
commit | 808344eecfedd04149551867724e46a7988c45a0 (patch) | |
tree | 523281c76405696f7ad0008887691baa09973735 /src/settings/components/form/KeymapsForm.jsx | |
parent | 4bac47249be20aff630fbecfe66fe021068a3095 (diff) |
Fix React Component tests
Diffstat (limited to 'src/settings/components/form/KeymapsForm.jsx')
-rw-r--r-- | src/settings/components/form/KeymapsForm.jsx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/settings/components/form/KeymapsForm.jsx b/src/settings/components/form/KeymapsForm.jsx index f5444fc..26a22d7 100644 --- a/src/settings/components/form/KeymapsForm.jsx +++ b/src/settings/components/form/KeymapsForm.jsx @@ -7,10 +7,6 @@ import keymaps from '../../keymaps'; class KeymapsForm extends React.Component { render() { - let values = this.props.value; - if (!values) { - values = {}; - } return <div className='form-keymaps-form'> { keymaps.fields.map((group, index) => { @@ -19,7 +15,7 @@ class KeymapsForm extends React.Component { group.map((field) => { let name = field[0]; let label = field[1]; - let value = values[name]; + let value = this.props.value[name] || ''; return <Input type='text' id={name} name={name} key={name} label={label} value={value} @@ -50,4 +46,8 @@ KeymapsForm.propTypes = { onChange: PropTypes.func, }; +KeymapsForm.defaultProps = { + value: {}, +}; + export default KeymapsForm; |