aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/content/actions/follow-controller.test.ts34
-rw-r--r--test/content/actions/input.test.ts19
-rw-r--r--test/content/actions/mark.test.ts25
-rw-r--r--test/content/components/common/follow.html17
-rw-r--r--test/content/components/common/follow.test.ts25
-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.ts31
8 files changed, 0 insertions, 223 deletions
diff --git a/test/content/actions/follow-controller.test.ts b/test/content/actions/follow-controller.test.ts
deleted file mode 100644
index a4b1710..0000000
--- a/test/content/actions/follow-controller.test.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import * as actions from 'content/actions';
-import * as followControllerActions from 'content/actions/follow-controller';
-
-describe('follow-controller actions', () => {
- describe('enable', () => {
- it('creates FOLLOW_CONTROLLER_ENABLE action', () => {
- let action = followControllerActions.enable(true);
- expect(action.type).to.equal(actions.FOLLOW_CONTROLLER_ENABLE);
- expect(action.newTab).to.equal(true);
- });
- });
-
- describe('disable', () => {
- it('creates FOLLOW_CONTROLLER_DISABLE action', () => {
- let action = followControllerActions.disable(true);
- expect(action.type).to.equal(actions.FOLLOW_CONTROLLER_DISABLE);
- });
- });
-
- describe('keyPress', () => {
- it('creates FOLLOW_CONTROLLER_KEY_PRESS action', () => {
- let action = followControllerActions.keyPress(100);
- expect(action.type).to.equal(actions.FOLLOW_CONTROLLER_KEY_PRESS);
- expect(action.key).to.equal(100);
- });
- });
-
- describe('backspace', () => {
- it('creates FOLLOW_CONTROLLER_BACKSPACE action', () => {
- let action = followControllerActions.backspace(100);
- expect(action.type).to.equal(actions.FOLLOW_CONTROLLER_BACKSPACE);
- });
- });
-});
diff --git a/test/content/actions/input.test.ts b/test/content/actions/input.test.ts
deleted file mode 100644
index 33238a5..0000000
--- a/test/content/actions/input.test.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import * as actions from 'content/actions';
-import * as inputActions from 'content/actions/input';
-
-describe("input actions", () => {
- describe("keyPress", () => {
- it('create INPUT_KEY_PRESS action', () => {
- let action = inputActions.keyPress('a');
- expect(action.type).to.equal(actions.INPUT_KEY_PRESS);
- expect(action.key).to.equal('a');
- });
- });
-
- describe("clearKeys", () => {
- it('create INPUT_CLEAR_KEYSaction', () => {
- let action = inputActions.clearKeys();
- expect(action.type).to.equal(actions.INPUT_CLEAR_KEYS);
- });
- });
-});
diff --git a/test/content/actions/mark.test.ts b/test/content/actions/mark.test.ts
deleted file mode 100644
index f2df367..0000000
--- a/test/content/actions/mark.test.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import * as actions from 'content/actions';
-import * as markActions from 'content/actions/mark';
-
-describe('mark actions', () => {
- describe('startSet', () => {
- it('create MARK_START_SET action', () => {
- let action = markActions.startSet();
- expect(action.type).to.equal(actions.MARK_START_SET);
- });
- });
-
- describe('startJump', () => {
- it('create MARK_START_JUMP action', () => {
- let action = markActions.startJump();
- expect(action.type).to.equal(actions.MARK_START_JUMP);
- });
- });
-
- describe('cancel', () => {
- it('create MARK_CANCEL action', () => {
- let action = markActions.cancel();
- expect(action.type).to.equal(actions.MARK_CANCEL);
- });
- });
-});
diff --git a/test/content/components/common/follow.html b/test/content/components/common/follow.html
deleted file mode 100644
index b2a2d74..0000000
--- a/test/content/components/common/follow.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<html>
- <body>
- <a id='visible_a' href='#' >link</a>
- <a href='#' style='display:none'>invisible 1</a>
- <a href='#' style='visibility:hidden'>invisible 2</a>
- <i>not link<i>
- <div id='editable_div_1' contenteditable>link</div>
- <div id='editable_div_2' contenteditable='true'>link</div>
- <div id='x' contenteditable='false'>link</div>
- <details>
- <summary id='summary_1'>summary link</summary>
- Some details
- <a href='#'>not visible</a>
- </details>
- </body>
-</html>
diff --git a/test/content/components/common/follow.test.ts b/test/content/components/common/follow.test.ts
deleted file mode 100644
index 90d6cf5..0000000
--- a/test/content/components/common/follow.test.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import FollowComponent from 'content/components/common/follow';
-
-describe('FollowComponent', () => {
- describe('#getTargetElements', () => {
- beforeEach(() => {
- document.body.innerHTML = __html__['test/content/components/common/follow.html'];
- });
-
- it('returns visible links', () => {
- let targets = FollowComponent.getTargetElements(
- window,
- { width: window.innerWidth, height: window.innerHeight },
- { x: 0, y: 0 });
- expect(targets).to.have.lengthOf(4);
-
- let ids = Array.prototype.map.call(targets, (e) => e.id);
- expect(ids).to.include.members([
- 'visible_a',
- 'editable_div_1',
- 'editable_div_2',
- 'summary_1',
- ]);
- });
- });
-});
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 918a560..0000000
--- a/test/content/reducers/mark.test.ts
+++ /dev/null
@@ -1,31 +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;
- });
-
- 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;
- });
-});