From 97117bdb129890872d6f1bedba6a0651d8fc003d Mon Sep 17 00:00:00 2001 From: alschmiedt Date: Mon, 30 Nov 2020 10:52:09 -0800 Subject: [PATCH] Update method names in shortcut registry (#4479) --- core/shortcut_registry.js | 6 +++--- tests/mocha/shortcut_registry_test.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/shortcut_registry.js b/core/shortcut_registry.js index f5b978915..b604f9675 100644 --- a/core/shortcut_registry.js +++ b/core/shortcut_registry.js @@ -218,7 +218,7 @@ Blockly.ShortcutRegistry.prototype.getRegistry = function() { */ Blockly.ShortcutRegistry.prototype.onKeyDown = function(workspace, e) { var key = this.serializeKeyEvent_(e); - var shortcutNames = this.getKeyboardShortcuts(key); + var shortcutNames = this.getShortcutNamesByKeyCode(key); if (!shortcutNames) { return false; } @@ -241,7 +241,7 @@ Blockly.ShortcutRegistry.prototype.onKeyDown = function(workspace, e) { * given keyCode is used. Undefined if no shortcuts exist. * @public */ -Blockly.ShortcutRegistry.prototype.getKeyboardShortcuts = function( +Blockly.ShortcutRegistry.prototype.getShortcutNamesByKeyCode = function( keyCode) { return this.keyMap_[keyCode] || []; }; @@ -254,7 +254,7 @@ Blockly.ShortcutRegistry.prototype.getKeyboardShortcuts = function( * registered under. * @public */ -Blockly.ShortcutRegistry.prototype.getKeyCodeByShortcutName = function( +Blockly.ShortcutRegistry.prototype.getKeyCodesByShortcutName = function( shortcutName) { var keys = []; for (var keyCode in this.keyMap_) { diff --git a/tests/mocha/shortcut_registry_test.js b/tests/mocha/shortcut_registry_test.js index 7465e623c..b374187d4 100644 --- a/tests/mocha/shortcut_registry_test.js +++ b/tests/mocha/shortcut_registry_test.js @@ -200,14 +200,14 @@ suite('Keyboard Shortcut Registry Test', function() { }); test('Gets keyboard shortcuts from a key code', function() { this.registry.keyMap_['keyCode'] = ['shortcutName']; - var shortcutNames = this.registry.getKeyboardShortcuts('keyCode'); + var shortcutNames = this.registry.getShortcutNamesByKeyCode('keyCode'); chai.assert.equal(shortcutNames[0], 'shortcutName'); }); test('Gets keycodes by shortcut name', function() { this.registry.keyMap_['keyCode'] = ['shortcutName']; this.registry.keyMap_['keyCode1'] = ['shortcutName']; var shortcutNames = - this.registry.getKeyCodeByShortcutName('shortcutName'); + this.registry.getKeyCodesByShortcutName('shortcutName'); chai.assert.lengthOf(shortcutNames, 2); chai.assert.equal(shortcutNames[0], 'keyCode'); chai.assert.equal(shortcutNames[1], 'keyCode1');