aboutsummaryrefslogtreecommitdiff
path: root/test/content/reducers
diff options
context:
space:
mode:
Diffstat (limited to 'test/content/reducers')
-rw-r--r--test/content/reducers/addon.test.ts17
-rw-r--r--test/content/reducers/find.test.ts22
-rw-r--r--test/content/reducers/follow-controller.test.ts47
-rw-r--r--test/content/reducers/input.test.ts25
-rw-r--r--test/content/reducers/mark.test.ts41
-rw-r--r--test/content/reducers/setting.test.ts31
6 files changed, 0 insertions, 183 deletions
diff --git a/test/content/reducers/addon.test.ts b/test/content/reducers/addon.test.ts
deleted file mode 100644
index fb05244..0000000
--- a/test/content/reducers/addon.test.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import * as actions from 'content/actions';
-import addonReducer from 'content/reducers/addon';
-
-describe("addon reducer", () => {
- it('return the initial state', () => {
- let state = addonReducer(undefined, {});
- expect(state).to.have.property('enabled', true);
- });
-
- it('return next state for ADDON_SET_ENABLED', () => {
- let action = { type: actions.ADDON_SET_ENABLED, enabled: true };
- let prev = { enabled: false };
- let state = addonReducer(prev, action);
-
- expect(state.enabled).is.equal(true);
- });
-});
diff --git a/test/content/reducers/find.test.ts b/test/content/reducers/find.test.ts
deleted file mode 100644
index 66a2c67..0000000
--- a/test/content/reducers/find.test.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import * as actions from 'content/actions';
-import findReducer from 'content/reducers/find';
-
-describe("find reducer", () => {
- it('return the initial state', () => {
- let state = findReducer(undefined, {});
- expect(state).to.have.property('keyword', null);
- expect(state).to.have.property('found', false);
- });
-
- it('return next state for FIND_SET_KEYWORD', () => {
- let action = {
- type: actions.FIND_SET_KEYWORD,
- keyword: 'xyz',
- found: true,
- };
- let state = findReducer({}, action);
-
- expect(state.keyword).is.equal('xyz');
- expect(state.found).to.be.true;
- });
-});
diff --git a/test/content/reducers/follow-controller.test.ts b/test/content/reducers/follow-controller.test.ts
deleted file mode 100644
index 39f326c..0000000
--- a/test/content/reducers/follow-controller.test.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-import * as actions from 'content/actions';
-import followControllerReducer from 'content/reducers/follow-controller';
-
-describe('follow-controller reducer', () => {
- it ('returns the initial state', () => {
- let state = followControllerReducer(undefined, {});
- expect(state).to.have.property('enabled', false);
- expect(state).to.have.property('newTab');
- expect(state).to.have.deep.property('keys', '');
- });
-
- it ('returns next state for FOLLOW_CONTROLLER_ENABLE', () => {
- let action = { type: actions.FOLLOW_CONTROLLER_ENABLE, newTab: true };
- let state = followControllerReducer({ 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_CONTROLLER_DISABLE', () => {
- let action = { type: actions.FOLLOW_CONTROLLER_DISABLE };
- let state = followControllerReducer({ enabled: true }, action);
- expect(state).to.have.property('enabled', false);
- });
-
- it ('returns next state for FOLLOW_CONTROLLER_KEY_PRESS', () => {
- let action = { type: actions.FOLLOW_CONTROLLER_KEY_PRESS, key: 'a'};
- let state = followControllerReducer({ keys: '' }, action);
- expect(state).to.have.deep.property('keys', 'a');
-
- action = { type: actions.FOLLOW_CONTROLLER_KEY_PRESS, key: 'b'};
- state = followControllerReducer(state, action);
- expect(state).to.have.deep.property('keys', 'ab');
- });
-
- it ('returns next state for FOLLOW_CONTROLLER_BACKSPACE', () => {
- let action = { type: actions.FOLLOW_CONTROLLER_BACKSPACE };
- let state = followControllerReducer({ keys: 'ab' }, action);
- expect(state).to.have.deep.property('keys', 'a');
-
- state = followControllerReducer(state, action);
- expect(state).to.have.deep.property('keys', '');
-
- state = followControllerReducer(state, action);
- expect(state).to.have.deep.property('keys', '');
- });
-});
diff --git a/test/content/reducers/input.test.ts b/test/content/reducers/input.test.ts
deleted file mode 100644
index f892201..0000000
--- a/test/content/reducers/input.test.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import * as actions from 'content/actions';
-import inputReducer from 'content/reducers/input';
-
-describe("input reducer", () => {
- it('return the initial state', () => {
- let state = inputReducer(undefined, {});
- expect(state).to.have.deep.property('keys', []);
- });
-
- it('return next state for INPUT_KEY_PRESS', () => {
- let action = { type: actions.INPUT_KEY_PRESS, key: 'a' };
- let state = inputReducer(undefined, action);
- expect(state).to.have.deep.property('keys', ['a']);
-
- action = { type: actions.INPUT_KEY_PRESS, key: 'b' };
- state = inputReducer(state, action);
- expect(state).to.have.deep.property('keys', ['a', 'b']);
- });
-
- it('return next state for INPUT_CLEAR_KEYS', () => {
- let action = { type: actions.INPUT_CLEAR_KEYS };
- let state = inputReducer({ keys: [1, 2, 3] }, action);
- expect(state).to.have.deep.property('keys', []);
- });
-});
diff --git a/test/content/reducers/mark.test.ts b/test/content/reducers/mark.test.ts
deleted file mode 100644
index 1a51c3e..0000000
--- a/test/content/reducers/mark.test.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import * as actions from 'content/actions';
-import reducer from 'content/reducers/mark';
-
-describe("mark reducer", () => {
- it('return the initial state', () => {
- let state = reducer(undefined, {});
- expect(state.setMode).to.be.false;
- expect(state.jumpMode).to.be.false;
- expect(state.marks).to.be.empty;
- });
-
- it('starts set mode', () => {
- let action = { type: actions.MARK_START_SET };
- let state = reducer(undefined, action);
- expect(state.setMode).to.be.true;
- });
-
- it('starts jump mode', () => {
- let action = { type: actions.MARK_START_JUMP };
- let state = reducer(undefined, action);
- expect(state.jumpMode).to.be.true;
- });
-
- it('cancels set and jump mode', () => {
- let action = { type: actions.MARK_CANCEL };
- let state = reducer({ setMode: true }, action);
- expect(state.setMode).to.be.false;
-
- state = reducer({ jumpMode: true }, action);
- expect(state.jumpMode).to.be.false;
- });
-
- it('stores local mark', () => {
- let action = { type: actions.MARK_SET_LOCAL, key: 'a', x: 20, y: 30};
- let state = reducer({ setMode: true }, action);
- expect(state.setMode).to.be.false;
- expect(state.marks['a']).to.be.an('object')
- expect(state.marks['a'].x).to.equal(20)
- expect(state.marks['a'].y).to.equal(30)
- });
-});
diff --git a/test/content/reducers/setting.test.ts b/test/content/reducers/setting.test.ts
deleted file mode 100644
index 9b332aa..0000000
--- a/test/content/reducers/setting.test.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import * as actions from 'content/actions';
-import settingReducer from 'content/reducers/setting';
-
-describe("content setting reducer", () => {
- it('return the initial state', () => {
- let state = settingReducer(undefined, {});
- expect(state.keymaps).to.be.empty;
- });
-
- it('return next state for SETTING_SET', () => {
- let newSettings = { red: 'apple', yellow: 'banana' };
- let action = {
- type: actions.SETTING_SET,
- settings: {
- keymaps: {
- "zz": { type: "zoom.neutral" },
- "<S-Esc>": { "type": "addon.toggle.enabled" }
- },
- "blacklist": []
- }
- }
- let state = settingReducer(undefined, action);
- expect(state.keymaps).to.have.deep.all.members([
- { key: [{ key: 'z', shiftKey: false, ctrlKey: false, altKey: false, metaKey: false },
- { key: 'z', shiftKey: false, ctrlKey: false, altKey: false, metaKey: false }],
- op: { type: 'zoom.neutral' }},
- { key: [{ key: 'Esc', shiftKey: true, ctrlKey: false, altKey: false, metaKey: false }],
- op: { type: 'addon.toggle.enabled' }},
- ]);
- });
-});