This repository has been archived on 2020-04-04. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Vim-Vixen/test/shared/keys.test.js
2017-10-01 17:18:26 +09:00

31 lines
691 B
JavaScript

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');
});
});