diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2020-04-13 20:37:36 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2020-04-13 20:37:36 +0900 |
commit | e1dac618a8b8929f601c7ec8aca3842c5ebf9d03 (patch) | |
tree | 6a914a8243c8c02e7752a83667a54d3fa832955c /test/shared/settings/Keymaps.test.ts | |
parent | 685f2b7b69218b06b5bb676069e35f79c5048c9b (diff) |
Use plugin:prettier/recommended
Diffstat (limited to 'test/shared/settings/Keymaps.test.ts')
-rw-r--r-- | test/shared/settings/Keymaps.test.ts | 81 |
1 files changed, 48 insertions, 33 deletions
diff --git a/test/shared/settings/Keymaps.test.ts b/test/shared/settings/Keymaps.test.ts index dcea6e4..264684d 100644 --- a/test/shared/settings/Keymaps.test.ts +++ b/test/shared/settings/Keymaps.test.ts @@ -1,65 +1,80 @@ -import Keymaps from '../../../src/shared/settings/Keymaps'; -import { expect } from 'chai'; +import Keymaps from "../../../src/shared/settings/Keymaps"; +import { expect } from "chai"; -describe('Keymaps', () => { - describe('#valueOf', () => { - it('returns empty object by empty settings', () => { +describe("Keymaps", () => { + describe("#valueOf", () => { + it("returns empty object by empty settings", () => { const keymaps = Keymaps.fromJSON({}).toJSON(); expect(keymaps).to.be.empty; }); - it('returns keymaps by valid settings', () => { + it("returns keymaps by valid settings", () => { const keymaps = Keymaps.fromJSON({ k: { type: "scroll.vertically", count: -1 }, j: { type: "scroll.vertically", count: 1 }, }).toJSON(); - expect(keymaps['k']).to.deep.equal({ type: "scroll.vertically", count: -1 }); - expect(keymaps['j']).to.deep.equal({ type: "scroll.vertically", count: 1 }); + expect(keymaps["k"]).to.deep.equal({ + type: "scroll.vertically", + count: -1, + }); + expect(keymaps["j"]).to.deep.equal({ + type: "scroll.vertically", + count: 1, + }); }); - it('throws a TypeError by invalid settings', () => { - expect(() => Keymaps.fromJSON({ - k: { type: "invalid.operation" }, - })).to.throw(TypeError); + it("throws a TypeError by invalid settings", () => { + expect(() => + Keymaps.fromJSON({ + k: { type: "invalid.operation" }, + }) + ).to.throw(TypeError); }); }); - describe('#combine', () => { - it('returns combined keymaps', () => { + describe("#combine", () => { + it("returns combined keymaps", () => { const keymaps = Keymaps.fromJSON({ k: { type: "scroll.vertically", count: -1 }, j: { type: "scroll.vertically", count: 1 }, - }).combine(Keymaps.fromJSON({ - n: { type: "find.next" }, - N: { type: "find.prev" }, - })); + }).combine( + Keymaps.fromJSON({ + n: { type: "find.next" }, + N: { type: "find.prev" }, + }) + ); - const entries = keymaps.entries().sort(([name1], [name2]) => name1.localeCompare(name2)); + const entries = keymaps + .entries() + .sort(([name1], [name2]) => name1.localeCompare(name2)); expect(entries).deep.equals([ - ['j', { type: "scroll.vertically", count: 1 }], - ['k', { type: "scroll.vertically", count: -1 }], - ['n', { type: "find.next" }], - ['N', { type: "find.prev" }], + ["j", { type: "scroll.vertically", count: 1 }], + ["k", { type: "scroll.vertically", count: -1 }], + ["n", { type: "find.next" }], + ["N", { type: "find.prev" }], ]); }); - it('overrides current keymaps', () => { + it("overrides current keymaps", () => { const keymaps = Keymaps.fromJSON({ k: { type: "scroll.vertically", count: -1 }, j: { type: "scroll.vertically", count: 1 }, - }).combine(Keymaps.fromJSON({ - n: { type: "find.next" }, - j: { type: "find.prev" }, - })); + }).combine( + Keymaps.fromJSON({ + n: { type: "find.next" }, + j: { type: "find.prev" }, + }) + ); - const entries = keymaps.entries().sort(([name1], [name2]) => name1.localeCompare(name2)); + const entries = keymaps + .entries() + .sort(([name1], [name2]) => name1.localeCompare(name2)); expect(entries).deep.equals([ - ['j', { type: "find.prev" }], - ['k', { type: "scroll.vertically", count: -1 }], - ['n', { type: "find.next" }], + ["j", { type: "find.prev" }], + ["k", { type: "scroll.vertically", count: -1 }], + ["n", { type: "find.next" }], ]); }); }); }); - |