From 808344eecfedd04149551867724e46a7988c45a0 Mon Sep 17 00:00:00 2001
From: Shin'ya Ueoka <ueokande@i-beam.org>
Date: Tue, 30 Apr 2019 09:03:01 +0900
Subject: Fix React Component tests

---
 src/settings/components/form/KeymapsForm.jsx | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'src/settings/components/form/KeymapsForm.jsx')

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;
-- 
cgit v1.2.3

