From 944683a2d8f9a165c490d05c350fdc689bdb6c85 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 8 Oct 2017 08:58:11 +0900 Subject: use key instead of keyCode in follow --- src/reducers/follow.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/reducers') diff --git a/src/reducers/follow.js b/src/reducers/follow.js index a2397b4..27543ec 100644 --- a/src/reducers/follow.js +++ b/src/reducers/follow.js @@ -3,7 +3,7 @@ import actions from 'actions'; const defaultState = { enabled: false, newTab: false, - keys: [], + keys: '', }; export default function reducer(state = defaultState, action = {}) { @@ -19,7 +19,7 @@ export default function reducer(state = defaultState, action = {}) { }); case actions.FOLLOW_KEY_PRESS: return Object.assign({}, state, { - keys: state.keys.concat([action.key]), + keys: state.keys + action.key, }); case actions.FOLLOW_BACKSPACE: return Object.assign({}, state, { -- cgit v1.2.3 From 38fee747603d37a99f1a8d156f41ea3d7c400b78 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 8 Oct 2017 10:12:52 +0900 Subject: reset follow on enabled --- src/reducers/follow.js | 1 + test/reducers/follow.test.js | 1 + 2 files changed, 2 insertions(+) (limited to 'src/reducers') diff --git a/src/reducers/follow.js b/src/reducers/follow.js index 27543ec..ed875e8 100644 --- a/src/reducers/follow.js +++ b/src/reducers/follow.js @@ -12,6 +12,7 @@ export default function reducer(state = defaultState, action = {}) { return Object.assign({}, state, { enabled: true, newTab: action.newTab, + keys: '', }); case actions.FOLLOW_DISABLE: return Object.assign({}, state, { diff --git a/test/reducers/follow.test.js b/test/reducers/follow.test.js index 0b5e3bd..e1db680 100644 --- a/test/reducers/follow.test.js +++ b/test/reducers/follow.test.js @@ -15,6 +15,7 @@ describe('follow reducer', () => { let state = followReducer({ enabled: false, newTab: false }, action); expect(state).to.have.property('enabled', true); expect(state).to.have.property('newTab', true); + expect(state).to.have.property('keys', ''); }); it ('returns next state for FOLLOW_DISABLE', () => { -- cgit v1.2.3