Spaces:
Sleeping
Sleeping
File size: 1,212 Bytes
2434dca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
import { expect } from "chai";
import getKeysymString from "../src/keysyms.js";
describe("getKeysymString tests", () => {
it("should return mapped keySym value from codesToKeySyms", () => {
const key = "Shift";
const code = "ShiftLeft";
const result = getKeysymString(key, code);
expect(result).to.equal("Shift_L");
});
it("should return the keysym for a single-character key from uniToKeySyms", () => {
const key = "A";
const code = "KeyA";
const result = getKeysymString(key, code);
expect(result).to.equal("A");
});
it("should handle non-ASCII characters from uniToKeySyms", () => {
const key = "ф";
const code = "KeyA";
const result = getKeysymString(key, code);
expect(result).to.equal("Cyrillic_ef");
});
it("should return the valid keySym from knownKeysyms", () => {
const key = "Tab";
const code = "Tab";
const result = getKeysymString(key, code);
expect(result).to.equal(code);
});
it("should return the default keySym if no match is found", () => {
const key = "InvalidKey";
const code = "InvalidCode";
const result = getKeysymString(key, code);
expect(result).to.equal("Unidentified");
});
});
|