aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-09-09 22:50:00 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-09-09 22:50:00 +0900
commit7e35d11f659029febd738c83b19ab4b8a8b69642 (patch)
treeabab11e010280811311f9a4214325160009d4129 /src
parente8056d2a709df9c9c182382fc7a31795e4dc1c0f (diff)
add console actions/reducer tests and fix targets
Diffstat (limited to 'src')
-rw-r--r--src/console/console.js4
-rw-r--r--src/reducers/console.js12
2 files changed, 8 insertions, 8 deletions
diff --git a/src/console/console.js b/src/console/console.js
index 044aa5f..35d98e0 100644
--- a/src/console/console.js
+++ b/src/console/console.js
@@ -1,12 +1,12 @@
import './console.scss';
import Completion from './completion';
-import consoleReducer, { defaultState } from '../reducers/console';
+import consoleReducer from '../reducers/console';
// TODO consider object-oriented
var prevValue = "";
var completion = null;
var completionOrigin = "";
-let state = defaultState;
+let state = consoleReducer(undefined, {});
const blurMessage = () => {
return {
diff --git a/src/reducers/console.js b/src/reducers/console.js
index 62fc951..3303802 100644
--- a/src/reducers/console.js
+++ b/src/reducers/console.js
@@ -1,10 +1,10 @@
import actions from '../actions';
-export const defaultState = {
- errorText: '',
+const defaultState = {
errorShown: false,
- commandText: '',
+ errorText: '',
commandShown: false,
+ commandText: '',
completions: [],
};
@@ -14,7 +14,7 @@ export default function reducer(state = defaultState, action = {}) {
return Object.assign({}, state, {
commandShown: true,
commandText: action.text,
- errorShow: false,
+ errorShown: false,
completions: []
});
case actions.CONSOLE_SET_COMPLETIONS:
@@ -23,8 +23,8 @@ export default function reducer(state = defaultState, action = {}) {
});
case actions.CONSOLE_SHOW_ERROR:
return Object.assign({}, state, {
- errorText: action.message,
- errorShow: true,
+ errorText: action.text,
+ errorShown: true,
commandShown: false,
});
case actions.CONSOLE_HIDE: