mirror of
https://github.com/VSCodeVim/Vim.git
synced 2024-09-20 00:27:41 +03:00
3a37d15504
* follow similar pattern to keyboardLayout * all user configurations accessible through configuration class * simplified the custom keyboard layout class
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
"use strict";
|
|
|
|
// The module 'assert' provides assertion methods from node
|
|
import * as assert from 'assert';
|
|
import {KeyboardLayout, IKeyMapper} from '../src/configuration/keyboard';
|
|
|
|
suite("KeyboardLayout", () => {
|
|
|
|
test("ctor", () => {
|
|
const layout = new KeyboardLayout();
|
|
assert.equal(layout.name, "en-US (QWERTY)");
|
|
});
|
|
|
|
test("lets keys through if using default layout", () => {
|
|
const layout = new KeyboardLayout();
|
|
assert.equal(layout.translate('>'), '>');
|
|
assert.equal(layout.translate(':'), ':');
|
|
assert.equal(layout.translate('.'), '.');
|
|
});
|
|
|
|
test("can use custom mapper", () => {
|
|
class FakeMapper implements IKeyMapper {
|
|
get name() : string {
|
|
return "fake mapper";
|
|
}
|
|
|
|
get(key : string) : string {
|
|
return "fake key";
|
|
}
|
|
}
|
|
|
|
const layout = new KeyboardLayout(new FakeMapper());
|
|
assert.equal(layout.name, "fake mapper");
|
|
assert.equal(layout.translate('>'), 'fake key');
|
|
assert.equal(layout.translate(':'), 'fake key');
|
|
assert.equal(layout.translate('.'), 'fake key');
|
|
});
|
|
});
|
|
|
|
suite("KeyMapperEsEsQwerty", () => {
|
|
// TODO: cannot set settings from api?
|
|
});
|