(#260) Added missing lookup for 'delete' key

This commit is contained in:
Simon Hofmann
2021-08-30 19:50:42 +02:00
parent 97ac21dbab
commit 6fe296ea8e
2 changed files with 27 additions and 1 deletions
@@ -101,7 +101,7 @@ export default class KeyboardAction implements KeyboardActionProvider {
[Key.Print, "printscreen"],
[Key.Pause, null],
[Key.Insert, "insert"],
[Key.Delete, null],
[Key.Delete, "delete"],
[Key.Home, "home"],
[Key.End, "end"],
[Key.PageUp, "pageup"],
@@ -175,4 +175,30 @@ describe("libnut keyboard action", () => {
expect(SUT.releaseKey(Key.A)).rejects.toThrowError("Test error");
});
});
describe("bugfix #260", () => {
it("should forward the pressKey call to libnut for 'delete'", () => {
// GIVEN
const SUT = new KeyboardAction();
// WHEN
SUT.pressKey(Key.Delete);
// THEN
expect(libnut.keyToggle).toBeCalledTimes(1);
expect(libnut.keyToggle).toBeCalledWith("delete", "down", []);
});
it("should forward the releaseKey call to libnut for 'delete'", () => {
// GIVEN
const SUT = new KeyboardAction();
// WHEN
SUT.releaseKey(Key.Delete);
// THEN
expect(libnut.keyToggle).toBeCalledTimes(1);
expect(libnut.keyToggle).toBeCalledWith("delete", "up", []);
});
});
});