aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actions/index.js8
-rw-r--r--src/console/actions/console.js (renamed from src/actions/console.js)2
-rw-r--r--src/console/actions/index.js9
-rw-r--r--src/console/components/completion.js (renamed from src/components/completion.js)2
-rw-r--r--src/console/components/console.js (renamed from src/components/console.js)4
-rw-r--r--src/console/index.html (renamed from src/pages/console.html)0
-rw-r--r--src/console/index.js (renamed from src/pages/console.js)10
-rw-r--r--src/console/reducers/index.js (renamed from src/reducers/console.js)2
-rw-r--r--src/console/site.scss (renamed from src/pages/console.scss)0
-rw-r--r--src/reducers/index.js3
-rw-r--r--test/console/actions/console.test.js (renamed from test/actions/console.test.js)4
-rw-r--r--test/console/reducers/console.test.js (renamed from test/reducers/console.test.js)30
-rw-r--r--webpack.config.js4
13 files changed, 38 insertions, 40 deletions
diff --git a/src/actions/index.js b/src/actions/index.js
index 6a64795..0b3749d 100644
--- a/src/actions/index.js
+++ b/src/actions/index.js
@@ -1,12 +1,4 @@
export default {
- // console commands
- CONSOLE_SHOW_COMMAND: 'console.show.command',
- CONSOLE_SET_COMPLETIONS: 'console.set.completions',
- CONSOLE_SHOW_ERROR: 'console.show.error',
- CONSOLE_HIDE: 'console.hide',
- CONSOLE_COMPLETION_NEXT: 'console.completion.next',
- CONSOLE_COMPLETION_PREV: 'console.completion.prev',
-
// User input
INPUT_KEY_PRESS: 'input.key,press',
INPUT_CLEAR_KEYS: 'input.clear.keys',
diff --git a/src/actions/console.js b/src/console/actions/console.js
index 4183489..01d9a9b 100644
--- a/src/actions/console.js
+++ b/src/console/actions/console.js
@@ -1,4 +1,4 @@
-import actions from 'actions';
+import actions from 'console/actions';
const showCommand = (text) => {
return {
diff --git a/src/console/actions/index.js b/src/console/actions/index.js
new file mode 100644
index 0000000..a5d03bc
--- /dev/null
+++ b/src/console/actions/index.js
@@ -0,0 +1,9 @@
+export default {
+ // console commands
+ CONSOLE_SHOW_COMMAND: 'console.show.command',
+ CONSOLE_SET_COMPLETIONS: 'console.set.completions',
+ CONSOLE_SHOW_ERROR: 'console.show.error',
+ CONSOLE_HIDE: 'console.hide',
+ CONSOLE_COMPLETION_NEXT: 'console.completion.next',
+ CONSOLE_COMPLETION_PREV: 'console.completion.prev',
+};
diff --git a/src/components/completion.js b/src/console/components/completion.js
index f527a84..5033b5c 100644
--- a/src/components/completion.js
+++ b/src/console/components/completion.js
@@ -6,7 +6,7 @@ export default class Completion {
}
update() {
- let state = this.store.getState().console;
+ let state = this.store.getState();
if (JSON.stringify(this.prevState) === JSON.stringify(state)) {
return;
}
diff --git a/src/components/console.js b/src/console/components/console.js
index 20d15c2..9023d91 100644
--- a/src/components/console.js
+++ b/src/console/components/console.js
@@ -1,5 +1,5 @@
import messages from 'shared/messages';
-import * as consoleActions from 'actions/console';
+import * as consoleActions from 'console/actions/console';
export default class ConsoleComponent {
constructor(wrapper, store) {
@@ -71,7 +71,7 @@ export default class ConsoleComponent {
}
update() {
- let state = this.store.getState().console;
+ let state = this.store.getState();
if (!this.prevState.commandShown && state.commandShown) {
this.showCommand(state.commandText);
} else if (!state.commandShown) {
diff --git a/src/pages/console.html b/src/console/index.html
index 4222f12..4222f12 100644
--- a/src/pages/console.html
+++ b/src/console/index.html
diff --git a/src/pages/console.js b/src/console/index.js
index 4c6e16c..1bcf8bc 100644
--- a/src/pages/console.js
+++ b/src/console/index.js
@@ -1,10 +1,10 @@
-import './console.scss';
+import './site.scss';
import messages from 'shared/messages';
-import CompletionComponent from 'components/completion';
-import ConsoleComponent from 'components/console';
-import reducers from 'reducers';
+import CompletionComponent from 'console/components/completion';
+import ConsoleComponent from 'console/components/console';
+import reducers from 'console/reducers';
import { createStore } from 'store';
-import * as consoleActions from 'actions/console';
+import * as consoleActions from 'console/actions/console';
const store = createStore(reducers);
let completionComponent = null;
diff --git a/src/reducers/console.js b/src/console/reducers/index.js
index b9ed5b8..ee9c691 100644
--- a/src/reducers/console.js
+++ b/src/console/reducers/index.js
@@ -1,4 +1,4 @@
-import actions from 'actions';
+import actions from 'console/actions';
const defaultState = {
errorShown: false,
diff --git a/src/pages/console.scss b/src/console/site.scss
index 5823dce..5823dce 100644
--- a/src/pages/console.scss
+++ b/src/console/site.scss
diff --git a/src/reducers/index.js b/src/reducers/index.js
index 8ed6452..3ebe491 100644
--- a/src/reducers/index.js
+++ b/src/reducers/index.js
@@ -1,11 +1,9 @@
import inputReducer from 'reducers/input';
-import consoleReducer from 'reducers/console';
import settingReducer from 'reducers/setting';
import followReducer from 'reducers/follow';
const defaultState = {
input: inputReducer(undefined, {}),
- console: consoleReducer(undefined, {}),
setting: settingReducer(undefined, {}),
follow: followReducer(undefined, {}),
};
@@ -13,7 +11,6 @@ const defaultState = {
export default function reducer(state = defaultState, action = {}) {
return Object.assign({}, state, {
input: inputReducer(state.input, action),
- console: consoleReducer(state.console, action),
setting: settingReducer(state.setting, action),
follow: followReducer(state.follow, action),
});
diff --git a/test/actions/console.test.js b/test/console/actions/console.test.js
index ff905bc..dd04c85 100644
--- a/test/actions/console.test.js
+++ b/test/console/actions/console.test.js
@@ -1,6 +1,6 @@
import { expect } from "chai";
-import actions from 'actions';
-import * as consoleActions from 'actions/console';
+import actions from 'console/actions';
+import * as consoleActions from 'console/actions/console';
describe("console actions", () => {
describe("showCommand", () => {
diff --git a/test/reducers/console.test.js b/test/console/reducers/console.test.js
index 5ebf4bc..95ac993 100644
--- a/test/reducers/console.test.js
+++ b/test/console/reducers/console.test.js
@@ -1,10 +1,10 @@
import { expect } from "chai";
-import actions from 'actions';
-import consoleReducer from 'reducers/console';
+import actions from 'console/actions';
+import reducer from 'console/reducers';
describe("console reducer", () => {
it('return the initial state', () => {
- let state = consoleReducer(undefined, {});
+ let state = reducer(undefined, {});
expect(state).to.have.property('errorShown', false);
expect(state).to.have.property('errorText', '');
expect(state).to.have.property('commandShown', false);
@@ -16,7 +16,7 @@ describe("console reducer", () => {
it('return next state for CONSOLE_SHOW_COMMAND', () => {
let action = { type: actions.CONSOLE_SHOW_COMMAND, text: 'open ' };
- let state = consoleReducer({}, action);
+ let state = reducer({}, action);
expect(state).to.have.property('commandShown', true);
expect(state).to.have.property('commandText', 'open ');
expect(state).to.have.property('errorShown', false);
@@ -24,7 +24,7 @@ describe("console reducer", () => {
it('return next state for CONSOLE_SHOW_ERROR', () => {
let action = { type: actions.CONSOLE_SHOW_ERROR, text: 'an error' };
- let state = consoleReducer({}, action);
+ let state = reducer({}, action);
expect(state).to.have.property('errorShown', true);
expect(state).to.have.property('errorText', 'an error');
expect(state).to.have.property('commandShown', false);
@@ -32,7 +32,7 @@ describe("console reducer", () => {
it('return next state for CONSOLE_HIDE', () => {
let action = { type: actions.CONSOLE_HIDE };
- let state = consoleReducer({}, action);
+ let state = reducer({}, action);
expect(state).to.have.property('errorShown', false);
expect(state).to.have.property('commandShown', false);
});
@@ -53,7 +53,7 @@ describe("console reducer", () => {
items: [4, 5, 6]
}]
}
- state = consoleReducer(state, action);
+ state = reducer(state, action);
expect(state).to.have.property('completions', action.completions);
expect(state).to.have.property('groupSelection', -1);
expect(state).to.have.property('itemSelection', -1);
@@ -73,16 +73,16 @@ describe("console reducer", () => {
}]
};
- state = consoleReducer(state, action);
+ state = reducer(state, action);
expect(state).to.have.property('groupSelection', 0);
expect(state).to.have.property('itemSelection', 0);
- state = consoleReducer(state, action);
+ state = reducer(state, action);
expect(state).to.have.property('groupSelection', 0);
expect(state).to.have.property('itemSelection', 1);
- state = consoleReducer(state, action);
- state = consoleReducer(state, action);
+ state = reducer(state, action);
+ state = reducer(state, action);
expect(state).to.have.property('groupSelection', -1);
expect(state).to.have.property('itemSelection', -1);
});
@@ -101,16 +101,16 @@ describe("console reducer", () => {
}]
};
- state = consoleReducer(state, action);
+ state = reducer(state, action);
expect(state).to.have.property('groupSelection', 1);
expect(state).to.have.property('itemSelection', 0);
- state = consoleReducer(state, action);
+ state = reducer(state, action);
expect(state).to.have.property('groupSelection', 0);
expect(state).to.have.property('itemSelection', 1);
- state = consoleReducer(state, action);
- state = consoleReducer(state, action);
+ state = reducer(state, action);
+ state = reducer(state, action);
expect(state).to.have.property('groupSelection', -1);
expect(state).to.have.property('itemSelection', -1);
});
diff --git a/webpack.config.js b/webpack.config.js
index 3d4ef03..486814a 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -9,7 +9,7 @@ module.exports = {
index: path.join(src, 'content'),
settings: path.join(src, 'pages/settings'),
background: path.join(src, 'background'),
- console: path.join(src, 'pages', 'console.js')
+ console: path.join(src, 'console')
},
output: {
@@ -45,7 +45,7 @@ module.exports = {
plugins: [
new HtmlWebpackPlugin({
- template: path.join(src, 'pages', 'console.html'),
+ template: path.join(src, 'console', 'index.html'),
filename: path.join(dist, 'console.html'),
inject: false
}),