diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-07 21:16:47 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-07 21:16:47 +0900 |
commit | 05ef6a8ca35aaa801c11eb6b4896caa3690058af (patch) | |
tree | 2c7708ca91ac2b462cc86aa28612e3d3943496f3 /test/content/reducers | |
parent | 457d954e08923b4accd28a919c72d0b61db1bb98 (diff) | |
parent | 27d0a7f37d24a0ad68a8ccb7dee18fc1d00eea58 (diff) |
Merge pull request #578 from ueokande/move-to-typescript
Move to TypeScript
Diffstat (limited to 'test/content/reducers')
-rw-r--r-- | test/content/reducers/addon.test.ts (renamed from test/content/reducers/addon.test.js) | 2 | ||||
-rw-r--r-- | test/content/reducers/find.test.ts (renamed from test/content/reducers/find.test.js) | 2 | ||||
-rw-r--r-- | test/content/reducers/follow-controller.test.ts (renamed from test/content/reducers/follow-controller.test.js) | 2 | ||||
-rw-r--r-- | test/content/reducers/input.test.ts (renamed from test/content/reducers/input.test.js) | 2 | ||||
-rw-r--r-- | test/content/reducers/mark.test.ts (renamed from test/content/reducers/mark.test.js) | 2 | ||||
-rw-r--r-- | test/content/reducers/setting.test.js | 17 | ||||
-rw-r--r-- | test/content/reducers/setting.test.ts | 31 |
7 files changed, 36 insertions, 22 deletions
diff --git a/test/content/reducers/addon.test.js b/test/content/reducers/addon.test.ts index d4eb845..fb05244 100644 --- a/test/content/reducers/addon.test.js +++ 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.js b/test/content/reducers/find.test.ts index a8c30d7..66a2c67 100644 --- a/test/content/reducers/find.test.js +++ 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.js b/test/content/reducers/follow-controller.test.ts index 8a4c2d4..39f326c 100644 --- a/test/content/reducers/follow-controller.test.js +++ 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.js b/test/content/reducers/input.test.ts index 0011943..f892201 100644 --- a/test/content/reducers/input.test.js +++ 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.js b/test/content/reducers/mark.test.ts index 76efbf7..1a51c3e 100644 --- a/test/content/reducers/mark.test.js +++ 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.js b/test/content/reducers/setting.test.js deleted file mode 100644 index 4e4c095..0000000 --- a/test/content/reducers/setting.test.js +++ /dev/null @@ -1,17 +0,0 @@ -import 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, value: newSettings }; - let state = settingReducer(undefined, action); - expect(state).to.deep.equal(newSettings); - expect(state).not.to.equal(newSettings); // assert deep copy - }); -}); diff --git a/test/content/reducers/setting.test.ts b/test/content/reducers/setting.test.ts new file mode 100644 index 0000000..9b332aa --- /dev/null +++ b/test/content/reducers/setting.test.ts @@ -0,0 +1,31 @@ +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' }}, + ]); + }); +}); |