Remove unused components

This commit is contained in:
Shin'ya Ueoka 2019-05-19 09:34:40 +09:00
parent e0c4182f14
commit 4be04628e1
27 changed files with 1 additions and 1083 deletions

View file

@ -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);
});
});
});

View file

@ -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);
});
});
});

View file

@ -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);
});
});
});

View file

@ -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>

View file

@ -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',
]);
});
});
});

View file

@ -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', '');
});
});

View file

@ -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', []);
});
});

View file

@ -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;
});
});