Types src/content
This commit is contained in:
parent
992b3ac65d
commit
d01db82c0d
62 changed files with 1411 additions and 468 deletions
|
@ -1,4 +1,4 @@
|
|||
import actions from 'content/actions';
|
||||
import * as actions from 'content/actions';
|
||||
import * as followControllerActions from 'content/actions/follow-controller';
|
||||
|
||||
describe('follow-controller actions', () => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import actions from 'content/actions';
|
||||
import * as actions from 'content/actions';
|
||||
import * as inputActions from 'content/actions/input';
|
||||
|
||||
describe("input actions", () => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import actions from 'content/actions';
|
||||
import * as actions from 'content/actions';
|
||||
import * as markActions from 'content/actions/mark';
|
||||
|
||||
describe('mark actions', () => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import actions from 'content/actions';
|
||||
import * as actions from 'content/actions';
|
||||
import * as settingActions from 'content/actions/setting';
|
||||
|
||||
describe("setting actions", () => {
|
||||
|
|
|
@ -21,12 +21,14 @@ describe('InputComponent', () => {
|
|||
++b;
|
||||
}
|
||||
});
|
||||
component.onKeyDown({ key: 'a' });
|
||||
component.onKeyDown({ key: 'b' });
|
||||
component.onKeyPress({ key: 'a' });
|
||||
component.onKeyUp({ key: 'a' });
|
||||
component.onKeyPress({ key: 'b' });
|
||||
component.onKeyUp({ key: 'b' });
|
||||
|
||||
let elem = document.body;
|
||||
component.onKeyDown({ key: 'a', target: elem });
|
||||
component.onKeyDown({ key: 'b', target: elem });
|
||||
component.onKeyPress({ key: 'a', target: elem });
|
||||
component.onKeyUp({ key: 'a', target: elem });
|
||||
component.onKeyPress({ key: 'b', target: elem });
|
||||
component.onKeyUp({ key: 'b', target: elem });
|
||||
|
||||
expect(a).is.equals(1);
|
||||
expect(b).is.equals(1);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import actions from 'content/actions';
|
||||
import * as actions from 'content/actions';
|
||||
import addonReducer from 'content/reducers/addon';
|
||||
|
||||
describe("addon reducer", () => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import actions from 'content/actions';
|
||||
import * as actions from 'content/actions';
|
||||
import findReducer from 'content/reducers/find';
|
||||
|
||||
describe("find reducer", () => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import actions from 'content/actions';
|
||||
import * as actions from 'content/actions';
|
||||
import followControllerReducer from 'content/reducers/follow-controller';
|
||||
|
||||
describe('follow-controller reducer', () => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import actions from 'content/actions';
|
||||
import * as actions from 'content/actions';
|
||||
import inputReducer from 'content/reducers/input';
|
||||
|
||||
describe("input reducer", () => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import actions from 'content/actions';
|
||||
import * as actions from 'content/actions';
|
||||
import reducer from 'content/reducers/mark';
|
||||
|
||||
describe("mark reducer", () => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import actions from 'content/actions';
|
||||
import * as actions from 'content/actions';
|
||||
import settingReducer from 'content/reducers/setting';
|
||||
|
||||
describe("content setting reducer", () => {
|
||||
|
|
41
test/shared/operations.test.ts
Normal file
41
test/shared/operations.test.ts
Normal file
|
@ -0,0 +1,41 @@
|
|||
import * as operations from 'shared/operations';
|
||||
|
||||
describe('operations', () => {
|
||||
describe('#valueOf', () => {
|
||||
it('returns an Operation', () => {
|
||||
let op: operations.Operation = operations.valueOf({
|
||||
type: operations.SCROLL_VERTICALLY,
|
||||
count: 10,
|
||||
});
|
||||
expect(op.type).to.equal(operations.SCROLL_VERTICALLY);
|
||||
expect(op.count).to.equal(10);
|
||||
});
|
||||
|
||||
it('throws an Error on missing required parameter', () => {
|
||||
expect(() => operations.valueOf({
|
||||
type: operations.SCROLL_VERTICALLY,
|
||||
})).to.throw(TypeError);
|
||||
});
|
||||
|
||||
it('fills default valus of optional parameter', () => {
|
||||
let op: operations.Operation = operations.valueOf({
|
||||
type: operations.COMMAND_SHOW_OPEN,
|
||||
});
|
||||
|
||||
expect(op.type).to.equal(operations.COMMAND_SHOW_OPEN)
|
||||
expect(op.alter).to.be.false;
|
||||
});
|
||||
|
||||
it('throws an Error on mismatch of parameter', () => {
|
||||
expect(() => operations.valueOf({
|
||||
type: operations.SCROLL_VERTICALLY,
|
||||
count: '10',
|
||||
})).to.throw(TypeError);
|
||||
|
||||
expect(() => valueOf({
|
||||
type: operations.COMMAND_SHOW_OPEN,
|
||||
alter: 'true',
|
||||
})).to.throw(TypeError);
|
||||
});
|
||||
});
|
||||
})
|
Reference in a new issue