aboutsummaryrefslogtreecommitdiff
path: root/test/content/actions/setting.test.ts
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-05-05 08:03:29 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2019-05-06 22:17:18 +0900
commita0882bbceb7ed71d56bf8557620449fbc3f19749 (patch)
treef2087d44f21dd68fc3584f62cfb9b62ae58bab2b /test/content/actions/setting.test.ts
parentd01db82c0dca352de2d7644c383d388fc3ec0366 (diff)
Declare setting types
Diffstat (limited to 'test/content/actions/setting.test.ts')
-rw-r--r--test/content/actions/setting.test.ts46
1 files changed, 27 insertions, 19 deletions
diff --git a/test/content/actions/setting.test.ts b/test/content/actions/setting.test.ts
index 0721d5d..c831433 100644
--- a/test/content/actions/setting.test.ts
+++ b/test/content/actions/setting.test.ts
@@ -4,32 +4,40 @@ import * as settingActions from 'content/actions/setting';
describe("setting actions", () => {
describe("set", () => {
it('create SETTING_SET action', () => {
- let action = settingActions.set({ red: 'apple', yellow: 'banana' });
+ let action = settingActions.set({
+ keymaps: {
+ 'dd': 'remove current tab',
+ 'z<C-A>': 'increment',
+ },
+ search: {
+ default: "google",
+ engines: {
+ google: 'https://google.com/search?q={}',
+ }
+ },
+ properties: {
+ hintchars: 'abcd1234',
+ },
+ blacklist: [],
+ });
expect(action.type).to.equal(actions.SETTING_SET);
- expect(action.value.red).to.equal('apple');
- expect(action.value.yellow).to.equal('banana');
- expect(action.value.keymaps).to.be.empty;
+ expect(action.settings.properties.hintchars).to.equal('abcd1234');
});
- it('converts keymaps', () => {
+ it('overrides cancel keys', () => {
let action = settingActions.set({
keymaps: {
- 'dd': 'remove current tab',
- 'z<C-A>': 'increment',
+ "k": { "type": "scroll.vertically", "count": -1 },
+ "j": { "type": "scroll.vertically", "count": 1 },
}
});
- let keymaps = action.value.keymaps;
- let map = new Map(keymaps);
- expect(map).to.have.deep.all.keys(
- [
- [{ key: 'Esc', shiftKey: false, ctrlKey: false, altKey: false, metaKey: false }],
- [{ key: '[', shiftKey: false, ctrlKey: true, altKey: false, metaKey: false }],
- [{ key: 'd', shiftKey: false, ctrlKey: false, altKey: false, metaKey: false },
- { key: 'd', shiftKey: false, ctrlKey: false, altKey: false, metaKey: false }],
- [{ key: 'z', shiftKey: false, ctrlKey: false, altKey: false, metaKey: false },
- { key: 'a', shiftKey: false, ctrlKey: true, altKey: false, metaKey: false }],
- ]
- );
+ let keymaps = action.settings.keymaps;
+ expect(action.settings.keymaps).to.deep.equals({
+ "k": { type: "scroll.vertically", count: -1 },
+ "j": { type: "scroll.vertically", count: 1 },
+ '<Esc>': { type: 'cancel' },
+ '<C-[>': { type: 'cancel' },
+ });
});
});
});