aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-10-08 15:19:25 +0900
committerGitHub <noreply@github.com>2017-10-08 15:19:25 +0900
commit0183161145d36cbafb7dbd86ca3a1aac6faca43f (patch)
treeaed757bfb5f8789156439d1e1fdff4e221376aaa
parent0f54a203dba38acdd080a928cee95f875fe84706 (diff)
parent57f798044d32ba7f9dc10a34ac31ad5dbdbf56ae (diff)
Merge pull request #22 from ueokande/separate-domains
Refactor: Separate domains
-rw-r--r--manifest.json2
-rw-r--r--src/background/actions/index.js0
-rw-r--r--src/background/actions/operation.js (renamed from src/actions/operation.js)45
-rw-r--r--src/background/actions/tab.js (renamed from src/actions/tab.js)0
-rw-r--r--src/background/components/background.js (renamed from src/components/background.js)14
-rw-r--r--src/background/index.js10
-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)6
-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)14
-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/content/actions/follow.js (renamed from src/actions/follow.js)2
-rw-r--r--src/content/actions/index.js (renamed from src/actions/index.js)8
-rw-r--r--src/content/actions/input.js (renamed from src/actions/input.js)2
-rw-r--r--src/content/actions/operation.js43
-rw-r--r--src/content/components/content-input.js (renamed from src/components/content-input.js)0
-rw-r--r--src/content/components/follow.js (renamed from src/components/follow.js)4
-rw-r--r--src/content/components/keymapper.js (renamed from src/components/keymapper.js)4
-rw-r--r--src/content/index.js14
-rw-r--r--src/content/reducers/follow.js (renamed from src/reducers/follow.js)2
-rw-r--r--src/content/reducers/index.js (renamed from src/reducers/index.js)10
-rw-r--r--src/content/reducers/input.js (renamed from src/reducers/input.js)2
-rw-r--r--src/settings/actions/index.js4
-rw-r--r--src/settings/actions/setting.js (renamed from src/actions/setting.js)4
-rw-r--r--src/settings/components/setting.js (renamed from src/components/setting.js)2
-rw-r--r--src/settings/index.html (renamed from src/pages/settings.html)0
-rw-r--r--src/settings/index.js (renamed from src/pages/settings.js)8
-rw-r--r--src/settings/reducers/setting.js (renamed from src/reducers/setting.js)2
-rw-r--r--src/settings/site.scss (renamed from src/pages/settings.scss)0
-rw-r--r--src/shared/messages.js (renamed from src/content/messages.js)0
-rw-r--r--src/shared/store/index.js (renamed from src/store/index.js)0
-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--test/content/actions/follow.test.js (renamed from test/actions/follow.test.js)4
-rw-r--r--test/content/actions/input.test.js (renamed from test/actions/input.test.js)4
-rw-r--r--test/content/components/follow.html (renamed from test/components/follow.html)0
-rw-r--r--test/content/components/follow.test.js (renamed from test/components/follow.test.js)4
-rw-r--r--test/content/reducers/follow.test.js (renamed from test/reducers/follow.test.js)4
-rw-r--r--test/content/reducers/input.test.js (renamed from test/reducers/input.test.js)4
-rw-r--r--test/settings/reducers/setting.test.js (renamed from test/reducers/setting.test.js)4
-rw-r--r--test/shared/store/index.test.js (renamed from test/store/index.test.js)2
-rw-r--r--webpack.config.js10
45 files changed, 147 insertions, 140 deletions
diff --git a/manifest.json b/manifest.json
index 7c60cdd..216023b 100644
--- a/manifest.json
+++ b/manifest.json
@@ -6,7 +6,7 @@
"content_scripts": [
{
"matches": [ "http://*/*", "https://*/*" ],
- "js": [ "build/index.js" ]
+ "js": [ "build/content.js" ]
}
],
"background": {
diff --git a/src/background/actions/index.js b/src/background/actions/index.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/background/actions/index.js
diff --git a/src/actions/operation.js b/src/background/actions/operation.js
index 0bb8310..d736c09 100644
--- a/src/actions/operation.js
+++ b/src/background/actions/operation.js
@@ -1,10 +1,7 @@
import operations from 'shared/operations';
-import messages from 'content/messages';
+import messages from 'shared/messages';
import * as tabs from 'background/tabs';
import * as zooms from 'background/zooms';
-import * as scrolls from 'content/scrolls';
-import * as navigates from 'content/navigates';
-import * as followActions from 'actions/follow';
const sendConsoleShowCommand = (tab, command) => {
return browser.tabs.sendMessage(tab.id, {
@@ -13,43 +10,7 @@ const sendConsoleShowCommand = (tab, command) => {
});
};
-const exec = (operation) => {
- switch (operation.type) {
- case operations.SCROLL_LINES:
- return scrolls.scrollLines(window, operation.count);
- case operations.SCROLL_PAGES:
- return scrolls.scrollPages(window, operation.count);
- case operations.SCROLL_TOP:
- return scrolls.scrollTop(window);
- case operations.SCROLL_BOTTOM:
- return scrolls.scrollBottom(window);
- case operations.SCROLL_HOME:
- return scrolls.scrollLeft(window);
- case operations.SCROLL_END:
- return scrolls.scrollRight(window);
- case operations.FOLLOW_START:
- return followActions.enable(false);
- case operations.NAVIGATE_HISTORY_PREV:
- return navigates.historyPrev(window);
- case operations.NAVIGATE_HISTORY_NEXT:
- return navigates.historyNext(window);
- case operations.NAVIGATE_LINK_PREV:
- return navigates.linkPrev(window);
- case operations.NAVIGATE_LINK_NEXT:
- return navigates.linkNext(window);
- case operations.NAVIGATE_PARENT:
- return navigates.parent(window);
- case operations.NAVIGATE_ROOT:
- return navigates.root(window);
- default:
- browser.runtime.sendMessage({
- type: messages.BACKGROUND_OPERATION,
- operation,
- });
- }
-};
-
-const execBackground = (operation, tab) => {
+const exec = (operation, tab) => {
switch (operation.type) {
case operations.TAB_CLOSE:
return tabs.closeTab(tab.id);
@@ -88,4 +49,4 @@ const execBackground = (operation, tab) => {
}
};
-export { exec, execBackground };
+export { exec };
diff --git a/src/actions/tab.js b/src/background/actions/tab.js
index e512b6f..e512b6f 100644
--- a/src/actions/tab.js
+++ b/src/background/actions/tab.js
diff --git a/src/components/background.js b/src/background/components/background.js
index 4961d85..bfe1b3f 100644
--- a/src/components/background.js
+++ b/src/background/components/background.js
@@ -1,7 +1,7 @@
-import messages from 'content/messages';
-import * as operationActions from 'actions/operation';
-import * as settingsActions from 'actions/setting';
-import * as tabActions from 'actions/tab';
+import messages from 'shared/messages';
+import * as operationActions from 'background/actions/operation';
+import * as settingsActions from 'settings/actions/setting';
+import * as tabActions from 'background/actions/tab';
import * as commands from 'shared/commands';
export default class BackgroundComponent {
@@ -23,7 +23,7 @@ export default class BackgroundComponent {
update() {
let state = this.store.getState();
- this.updateSettings(state.setting);
+ this.updateSettings(state);
}
updateSettings(setting) {
@@ -37,7 +37,7 @@ export default class BackgroundComponent {
switch (message.type) {
case messages.BACKGROUND_OPERATION:
return this.store.dispatch(
- operationActions.execBackground(message.operation, sender.tab),
+ operationActions.exec(message.operation, sender.tab),
sender);
case messages.OPEN_URL:
if (message.newTab) {
@@ -58,7 +58,7 @@ export default class BackgroundComponent {
});
});
case messages.SETTINGS_QUERY:
- return Promise.resolve(this.store.getState().setting.settings);
+ return Promise.resolve(this.store.getState().settings);
case messages.CONSOLE_QUERY_COMPLETIONS:
return commands.complete(message.text, this.settings);
case messages.SETTINGS_RELOAD:
diff --git a/src/background/index.js b/src/background/index.js
index dbc10fb..6ba37eb 100644
--- a/src/background/index.js
+++ b/src/background/index.js
@@ -1,8 +1,8 @@
-import * as settingsActions from 'actions/setting';
-import messages from 'content/messages';
-import BackgroundComponent from 'components/background';
-import reducers from 'reducers';
-import { createStore } from 'store';
+import * as settingsActions from 'settings/actions/setting';
+import messages from 'shared/messages';
+import BackgroundComponent from 'background/components/background';
+import reducers from 'settings/reducers/setting';
+import { createStore } from 'shared/store';
const store = createStore(reducers, (e, sender) => {
console.error('Vim-Vixen:', e);
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 12341c1..9023d91 100644
--- a/src/components/console.js
+++ b/src/console/components/console.js
@@ -1,5 +1,5 @@
-import messages from 'content/messages';
-import * as consoleActions from 'actions/console';
+import messages from 'shared/messages';
+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 b7be73d..7396a96 100644
--- a/src/pages/console.js
+++ b/src/console/index.js
@@ -1,10 +1,10 @@
-import './console.scss';
-import messages from 'content/messages';
-import CompletionComponent from 'components/completion';
-import ConsoleComponent from 'components/console';
-import reducers from 'reducers';
-import { createStore } from 'store';
-import * as consoleActions from 'actions/console';
+import './site.scss';
+import messages from 'shared/messages';
+import CompletionComponent from 'console/components/completion';
+import ConsoleComponent from 'console/components/console';
+import reducers from 'console/reducers';
+import { createStore } from 'shared/store';
+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/actions/follow.js b/src/content/actions/follow.js
index 708cd95..5a18dd5 100644
--- a/src/actions/follow.js
+++ b/src/content/actions/follow.js
@@ -1,4 +1,4 @@
-import actions from 'actions';
+import actions from 'content/actions';
const enable = (newTab) => {
return {
diff --git a/src/actions/index.js b/src/content/actions/index.js
index 6a64795..0b3749d 100644
--- a/src/actions/index.js
+++ b/src/content/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/input.js b/src/content/actions/input.js
index 61acb76..cc4efac 100644
--- a/src/actions/input.js
+++ b/src/content/actions/input.js
@@ -1,4 +1,4 @@
-import actions from 'actions';
+import actions from 'content/actions';
const asKeymapChars = (key, ctrl) => {
if (ctrl) {
diff --git a/src/content/actions/operation.js b/src/content/actions/operation.js
new file mode 100644
index 0000000..d188a60
--- /dev/null
+++ b/src/content/actions/operation.js
@@ -0,0 +1,43 @@
+import operations from 'shared/operations';
+import messages from 'shared/messages';
+import * as scrolls from 'content/scrolls';
+import * as navigates from 'content/navigates';
+import * as followActions from 'content/actions/follow';
+
+const exec = (operation) => {
+ switch (operation.type) {
+ case operations.SCROLL_LINES:
+ return scrolls.scrollLines(window, operation.count);
+ case operations.SCROLL_PAGES:
+ return scrolls.scrollPages(window, operation.count);
+ case operations.SCROLL_TOP:
+ return scrolls.scrollTop(window);
+ case operations.SCROLL_BOTTOM:
+ return scrolls.scrollBottom(window);
+ case operations.SCROLL_HOME:
+ return scrolls.scrollLeft(window);
+ case operations.SCROLL_END:
+ return scrolls.scrollRight(window);
+ case operations.FOLLOW_START:
+ return followActions.enable(false);
+ case operations.NAVIGATE_HISTORY_PREV:
+ return navigates.historyPrev(window);
+ case operations.NAVIGATE_HISTORY_NEXT:
+ return navigates.historyNext(window);
+ case operations.NAVIGATE_LINK_PREV:
+ return navigates.linkPrev(window);
+ case operations.NAVIGATE_LINK_NEXT:
+ return navigates.linkNext(window);
+ case operations.NAVIGATE_PARENT:
+ return navigates.parent(window);
+ case operations.NAVIGATE_ROOT:
+ return navigates.root(window);
+ default:
+ browser.runtime.sendMessage({
+ type: messages.BACKGROUND_OPERATION,
+ operation,
+ });
+ }
+};
+
+export { exec };
diff --git a/src/components/content-input.js b/src/content/components/content-input.js
index 9568caf..9568caf 100644
--- a/src/components/content-input.js
+++ b/src/content/components/content-input.js
diff --git a/src/components/follow.js b/src/content/components/follow.js
index eedbd4d..c87424d 100644
--- a/src/components/follow.js
+++ b/src/content/components/follow.js
@@ -1,5 +1,5 @@
-import * as followActions from 'actions/follow';
-import messages from 'content/messages';
+import * as followActions from 'content/actions/follow';
+import messages from 'shared/messages';
import Hint from 'content/hint';
import HintKeyProducer from 'content/hint-key-producer';
diff --git a/src/components/keymapper.js b/src/content/components/keymapper.js
index 3685a4f..8f2cead 100644
--- a/src/components/keymapper.js
+++ b/src/content/components/keymapper.js
@@ -1,5 +1,5 @@
-import * as inputActions from 'actions/input';
-import * as operationActions from 'actions/operation';
+import * as inputActions from 'content/actions/input';
+import * as operationActions from 'content/actions/operation';
export default class KeymapperComponent {
constructor(store) {
diff --git a/src/content/index.js b/src/content/index.js
index d380291..adea871 100644
--- a/src/content/index.js
+++ b/src/content/index.js
@@ -1,12 +1,12 @@
import './console-frame.scss';
import * as consoleFrames from './console-frames';
-import * as settingActions from 'actions/setting';
-import { createStore } from 'store';
-import ContentInputComponent from 'components/content-input';
-import KeymapperComponent from 'components/keymapper';
-import FollowComponent from 'components/follow';
-import reducers from 'reducers';
-import messages from './messages';
+import * as settingActions from 'settings/actions/setting';
+import { createStore } from 'shared/store';
+import ContentInputComponent from 'content/components/content-input';
+import KeymapperComponent from 'content/components/keymapper';
+import FollowComponent from 'content/components/follow';
+import reducers from 'content/reducers';
+import messages from 'shared/messages';
const store = createStore(reducers);
const followComponent = new FollowComponent(window.document.body, store);
diff --git a/src/reducers/follow.js b/src/content/reducers/follow.js
index ed875e8..b7c0cf3 100644
--- a/src/reducers/follow.js
+++ b/src/content/reducers/follow.js
@@ -1,4 +1,4 @@
-import actions from 'actions';
+import actions from 'content/actions';
const defaultState = {
enabled: false,
diff --git a/src/reducers/index.js b/src/content/reducers/index.js
index 8ed6452..a62217f 100644
--- a/src/reducers/index.js
+++ b/src/content/reducers/index.js
@@ -1,11 +1,10 @@
-import inputReducer from 'reducers/input';
-import consoleReducer from 'reducers/console';
-import settingReducer from 'reducers/setting';
-import followReducer from 'reducers/follow';
+import settingReducer from 'settings/reducers/setting';
+import inputReducer from './input';
+import followReducer from './follow';
+// Make setting reducer instead of re-use
const defaultState = {
input: inputReducer(undefined, {}),
- console: consoleReducer(undefined, {}),
setting: settingReducer(undefined, {}),
follow: followReducer(undefined, {}),
};
@@ -13,7 +12,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/src/reducers/input.js b/src/content/reducers/input.js
index 2e4bcd8..802020f 100644
--- a/src/reducers/input.js
+++ b/src/content/reducers/input.js
@@ -1,4 +1,4 @@
-import actions from 'actions';
+import actions from 'content/actions';
const defaultState = {
keys: '',
diff --git a/src/settings/actions/index.js b/src/settings/actions/index.js
new file mode 100644
index 0000000..8c212c2
--- /dev/null
+++ b/src/settings/actions/index.js
@@ -0,0 +1,4 @@
+export default {
+ // Settings
+ SETTING_SET_SETTINGS: 'setting.set.settings',
+};
diff --git a/src/actions/setting.js b/src/settings/actions/setting.js
index 2a47608..697bcf0 100644
--- a/src/actions/setting.js
+++ b/src/settings/actions/setting.js
@@ -1,5 +1,5 @@
-import actions from 'actions';
-import messages from 'content/messages';
+import actions from 'settings/actions';
+import messages from 'shared/messages';
import DefaultSettings from 'shared/default-settings';
const load = () => {
diff --git a/src/components/setting.js b/src/settings/components/setting.js
index c2f99b6..14482a3 100644
--- a/src/components/setting.js
+++ b/src/settings/components/setting.js
@@ -1,4 +1,4 @@
-import * as settingActions from 'actions/setting';
+import * as settingActions from 'settings/actions/setting';
import { validate } from 'shared/validators/setting';
export default class SettingComponent {
diff --git a/src/pages/settings.html b/src/settings/index.html
index 99d6c6b..99d6c6b 100644
--- a/src/pages/settings.html
+++ b/src/settings/index.html
diff --git a/src/pages/settings.js b/src/settings/index.js
index 6e25e6f..c8d6cc4 100644
--- a/src/pages/settings.js
+++ b/src/settings/index.js
@@ -1,7 +1,7 @@
-import './settings.scss';
-import SettingComponent from 'components/setting';
-import settingReducer from 'reducers/setting';
-import { createStore } from 'store';
+import './site.scss';
+import SettingComponent from 'settings/components/setting';
+import settingReducer from 'settings/reducers/setting';
+import { createStore } from 'shared/store';
const store = createStore(settingReducer);
let settingComponent = null;
diff --git a/src/reducers/setting.js b/src/settings/reducers/setting.js
index 7326ed7..f7d9242 100644
--- a/src/reducers/setting.js
+++ b/src/settings/reducers/setting.js
@@ -1,4 +1,4 @@
-import actions from 'actions';
+import actions from 'settings/actions';
const defaultState = {
settings: {}
diff --git a/src/pages/settings.scss b/src/settings/site.scss
index 5707c8a..5707c8a 100644
--- a/src/pages/settings.scss
+++ b/src/settings/site.scss
diff --git a/src/content/messages.js b/src/shared/messages.js
index 138f0e0..138f0e0 100644
--- a/src/content/messages.js
+++ b/src/shared/messages.js
diff --git a/src/store/index.js b/src/shared/store/index.js
index 2fafdf1..2fafdf1 100644
--- a/src/store/index.js
+++ b/src/shared/store/index.js
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/test/actions/follow.test.js b/test/content/actions/follow.test.js
index 32ab9e2..3ac844c 100644
--- a/test/actions/follow.test.js
+++ b/test/content/actions/follow.test.js
@@ -1,6 +1,6 @@
import { expect } from "chai";
-import actions from 'actions';
-import * as followActions from 'actions/follow';
+import actions from 'content/actions';
+import * as followActions from 'content/actions/follow';
describe('follow actions', () => {
describe('enable', () => {
diff --git a/test/actions/input.test.js b/test/content/actions/input.test.js
index 0a2ab18..6031829 100644
--- a/test/actions/input.test.js
+++ b/test/content/actions/input.test.js
@@ -1,6 +1,6 @@
import { expect } from "chai";
-import actions from 'actions';
-import * as inputActions from 'actions/input';
+import actions from 'content/actions';
+import * as inputActions from 'content/actions/input';
describe("input actions", () => {
describe("keyPress", () => {
diff --git a/test/components/follow.html b/test/content/components/follow.html
index 6bd8f87..6bd8f87 100644
--- a/test/components/follow.html
+++ b/test/content/components/follow.html
diff --git a/test/components/follow.test.js b/test/content/components/follow.test.js
index 294bfc9..9c00c79 100644
--- a/test/components/follow.test.js
+++ b/test/content/components/follow.test.js
@@ -1,10 +1,10 @@
import { expect } from "chai";
-import FollowComponent from 'components/follow';
+import FollowComponent from 'content/components/follow';
describe('FollowComponent', () => {
describe('#getTargetElements', () => {
beforeEach(() => {
- document.body.innerHTML = __html__['test/components/follow.html'];
+ document.body.innerHTML = __html__['test/content/components/follow.html'];
});
it('returns visible links', () => {
diff --git a/test/reducers/follow.test.js b/test/content/reducers/follow.test.js
index e1db680..e2b3445 100644
--- a/test/reducers/follow.test.js
+++ b/test/content/reducers/follow.test.js
@@ -1,6 +1,6 @@
import { expect } from "chai";
-import actions from 'actions';
-import followReducer from 'reducers/follow';
+import actions from 'content/actions';
+import followReducer from 'content/reducers/follow';
describe('follow reducer', () => {
it ('returns the initial state', () => {
diff --git a/test/reducers/input.test.js b/test/content/reducers/input.test.js
index 7b5a89c..d5e5f6b 100644
--- a/test/reducers/input.test.js
+++ b/test/content/reducers/input.test.js
@@ -1,6 +1,6 @@
import { expect } from "chai";
-import actions from 'actions';
-import inputReducer from 'reducers/input';
+import actions from 'content/actions';
+import inputReducer from 'content/reducers/input';
describe("input reducer", () => {
it('return the initial state', () => {
diff --git a/test/reducers/setting.test.js b/test/settings/reducers/setting.test.js
index 1af031a..0e84247 100644
--- a/test/reducers/setting.test.js
+++ b/test/settings/reducers/setting.test.js
@@ -1,6 +1,6 @@
import { expect } from "chai";
-import actions from 'actions';
-import settingReducer from 'reducers/setting';
+import actions from 'settings/actions';
+import settingReducer from 'settings/reducers/setting';
describe("setting reducer", () => {
it('return the initial state', () => {
diff --git a/test/store/index.test.js b/test/shared/store/index.test.js
index 5dce715..133033b 100644
--- a/test/store/index.test.js
+++ b/test/shared/store/index.test.js
@@ -1,5 +1,5 @@
import { expect } from "chai";
-import { createStore } from 'store';
+import { createStore } from 'shared/store';
describe("Store class", () => {
const reducer = (state, action) => {
diff --git a/webpack.config.js b/webpack.config.js
index 3d4ef03..fff49d1 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -6,10 +6,10 @@ const dist = path.resolve(__dirname, 'build');
module.exports = {
entry: {
- index: path.join(src, 'content'),
- settings: path.join(src, 'pages/settings'),
+ content: path.join(src, 'content'),
+ settings: path.join(src, 'settings'),
background: path.join(src, 'background'),
- console: path.join(src, 'pages', 'console.js')
+ console: path.join(src, 'console')
},
output: {
@@ -45,12 +45,12 @@ 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
}),
new HtmlWebpackPlugin({
- template: path.join(src, 'pages', 'settings.html'),
+ template: path.join(src, 'settings', 'index.html'),
filename: path.join(dist, 'settings.html'),
inject: false
})