Don't change KEYBOARD_SHORTCUTS and do some refactoring (#7818)

This commit is contained in:
Šimon Brandner 2022-02-16 16:24:00 +01:00 committed by GitHub
parent 0dc1355441
commit 81f52283cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 7 deletions

View file

@ -17,13 +17,24 @@ limitations under the License.
import {
CATEGORIES,
CategoryName,
getCustomizableShortcuts,
getKeyboardShortcuts,
KEYBOARD_SHORTCUTS,
registerShortcut,
} from "../../src/accessibility/KeyboardShortcuts";
import { Key } from "../../src/Keyboard";
import { ISetting } from "../../src/settings/Settings";
describe("KeyboardShortcuts", () => {
it("doesn't change KEYBOARD_SHORTCUTS when getting shortcuts", () => {
const copyKeyboardShortcuts = Object.assign({}, KEYBOARD_SHORTCUTS);
getCustomizableShortcuts();
expect(KEYBOARD_SHORTCUTS).toEqual(copyKeyboardShortcuts);
getKeyboardShortcuts();
expect(KEYBOARD_SHORTCUTS).toEqual(copyKeyboardShortcuts);
});
describe("registerShortcut()", () => {
it("correctly registers shortcut", () => {
const shortcutName = "Keybinding.definitelyARealShortcut";