aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-05-02 14:08:51 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2019-05-05 23:59:59 +0900
commitd01db82c0dca352de2d7644c383d388fc3ec0366 (patch)
treeff09ebc545ce00192dff9e1119b0c9e2cf92fdef /test
parent992b3ac65d7fe86ac7bc3b560960c8bcf86bec69 (diff)
Types src/content
Diffstat (limited to 'test')
-rw-r--r--test/content/actions/follow-controller.test.ts2
-rw-r--r--test/content/actions/input.test.ts2
-rw-r--r--test/content/actions/mark.test.ts2
-rw-r--r--test/content/actions/setting.test.ts2
-rw-r--r--test/content/components/common/input.test.ts14
-rw-r--r--test/content/reducers/addon.test.ts2
-rw-r--r--test/content/reducers/find.test.ts2
-rw-r--r--test/content/reducers/follow-controller.test.ts2
-rw-r--r--test/content/reducers/input.test.ts2
-rw-r--r--test/content/reducers/mark.test.ts2
-rw-r--r--test/content/reducers/setting.test.ts2
-rw-r--r--test/shared/operations.test.ts41
12 files changed, 59 insertions, 16 deletions
diff --git a/test/content/actions/follow-controller.test.ts b/test/content/actions/follow-controller.test.ts
index 718a90a..a4b1710 100644
--- a/test/content/actions/follow-controller.test.ts
+++ b/test/content/actions/follow-controller.test.ts
@@ -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', () => {
diff --git a/test/content/actions/input.test.ts b/test/content/actions/input.test.ts
index fe9db5f..33238a5 100644
--- a/test/content/actions/input.test.ts
+++ b/test/content/actions/input.test.ts
@@ -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", () => {
diff --git a/test/content/actions/mark.test.ts b/test/content/actions/mark.test.ts
index adbf06b..6c6d59e 100644
--- a/test/content/actions/mark.test.ts
+++ b/test/content/actions/mark.test.ts
@@ -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', () => {
diff --git a/test/content/actions/setting.test.ts b/test/content/actions/setting.test.ts
index 10f6807..0721d5d 100644
--- a/test/content/actions/setting.test.ts
+++ b/test/content/actions/setting.test.ts
@@ -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", () => {
diff --git a/test/content/components/common/input.test.ts b/test/content/components/common/input.test.ts
index 2ba5507..f3a943c 100644
--- a/test/content/components/common/input.test.ts
+++ b/test/content/components/common/input.test.ts
@@ -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);
diff --git a/test/content/reducers/addon.test.ts b/test/content/reducers/addon.test.ts
index d4eb845..fb05244 100644
--- a/test/content/reducers/addon.test.ts
+++ b/test/content/reducers/addon.test.ts
@@ -1,4 +1,4 @@
-import actions from 'content/actions';
+import * as actions from 'content/actions';
import addonReducer from 'content/reducers/addon';
describe("addon reducer", () => {
diff --git a/test/content/reducers/find.test.ts b/test/content/reducers/find.test.ts
index a8c30d7..66a2c67 100644
--- a/test/content/reducers/find.test.ts
+++ b/test/content/reducers/find.test.ts
@@ -1,4 +1,4 @@
-import actions from 'content/actions';
+import * as actions from 'content/actions';
import findReducer from 'content/reducers/find';
describe("find reducer", () => {
diff --git a/test/content/reducers/follow-controller.test.ts b/test/content/reducers/follow-controller.test.ts
index 8a4c2d4..39f326c 100644
--- a/test/content/reducers/follow-controller.test.ts
+++ b/test/content/reducers/follow-controller.test.ts
@@ -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', () => {
diff --git a/test/content/reducers/input.test.ts b/test/content/reducers/input.test.ts
index 0011943..f892201 100644
--- a/test/content/reducers/input.test.ts
+++ b/test/content/reducers/input.test.ts
@@ -1,4 +1,4 @@
-import actions from 'content/actions';
+import * as actions from 'content/actions';
import inputReducer from 'content/reducers/input';
describe("input reducer", () => {
diff --git a/test/content/reducers/mark.test.ts b/test/content/reducers/mark.test.ts
index 76efbf7..1a51c3e 100644
--- a/test/content/reducers/mark.test.ts
+++ b/test/content/reducers/mark.test.ts
@@ -1,4 +1,4 @@
-import actions from 'content/actions';
+import * as actions from 'content/actions';
import reducer from 'content/reducers/mark';
describe("mark reducer", () => {
diff --git a/test/content/reducers/setting.test.ts b/test/content/reducers/setting.test.ts
index 4e4c095..226fc58 100644
--- a/test/content/reducers/setting.test.ts
+++ b/test/content/reducers/setting.test.ts
@@ -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", () => {
diff --git a/test/shared/operations.test.ts b/test/shared/operations.test.ts
new file mode 100644
index 0000000..42a3eed
--- /dev/null
+++ b/test/shared/operations.test.ts
@@ -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);
+ });
+ });
+})