diff options
| author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-01 17:17:20 +0900 | 
|---|---|---|
| committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-01 17:18:26 +0900 | 
| commit | a74a8b537e8a82f1af63667fd73869b83d8b7d0d (patch) | |
| tree | 64d5ae21d2510475af9516efb061ea912b8decff /test/shared | |
| parent | 825bb6347623d998c671d3d42268230d1a783d76 (diff) | |
BackgroundInputComponent
Diffstat (limited to 'test/shared')
| -rw-r--r-- | test/shared/keys.test.js | 31 | 
1 files changed, 31 insertions, 0 deletions
diff --git a/test/shared/keys.test.js b/test/shared/keys.test.js new file mode 100644 index 0000000..53c953d --- /dev/null +++ b/test/shared/keys.test.js @@ -0,0 +1,31 @@ +import { expect } from "chai"; +import * as keys from '../../src/shared/keys'; + +describe("keys", () => { +  const KEYMAP = { +    'g<C-X>GG': [], +    'gg': { type: 'scroll.top' }, +  }; + +  const g = 'g'.charCodeAt(0); +  const G = 'G'.charCodeAt(0); +  const x = 'x'.charCodeAt(0); + +  describe('#asKeymapChars', () => { +    let keySequence = [ +      { code: g }, +      { code: x, ctrl: true }, +      { code: G } +    ]; +    expect(keys.asKeymapChars(keySequence)).to.equal('g<C-X>G'); +  }); + +  describe('#asCaretChars', () => { +    let keySequence = [ +      { code: g }, +      { code: x, ctrl: true }, +      { code: G } +    ]; +    expect(keys.asCaretChars(keySequence)).to.equal('g^XG'); +  }); +});  | 
