This commit is contained in:
+5
-3
@@ -409,13 +409,15 @@ function createWindow() {
|
||||
function registerHotkeys() {
|
||||
globalShortcut.unregisterAll();
|
||||
const zoomBindings = [
|
||||
['CommandOrControl+=', 'in'],
|
||||
['CommandOrControl+Plus', 'in'],
|
||||
['CommandOrControl+Shift+=', 'in'],
|
||||
['CommandOrControl+Add', 'in'],
|
||||
['CommandOrControl+=', 'in'],
|
||||
['CommandOrControl+numadd', 'in'],
|
||||
['CommandOrControl+-', 'out'],
|
||||
['CommandOrControl+Minus', 'out'],
|
||||
['CommandOrControl+Subtract', 'out'],
|
||||
['CommandOrControl+numsub', 'out'],
|
||||
['CommandOrControl+0', 'fit'],
|
||||
['CommandOrControl+num0', 'fit'],
|
||||
];
|
||||
for (const [accel, kind] of zoomBindings) {
|
||||
try {
|
||||
|
||||
@@ -11,6 +11,7 @@ const {
|
||||
test('zoom shortcut helper recognizes zoom in, out, and fit across event shapes', () => {
|
||||
assert.equal(zoomShortcutFromKeyboardEvent({ ctrlKey: true, key: '=', code: 'Equal' }), 'in');
|
||||
assert.equal(zoomShortcutFromKeyboardEvent({ ctrlKey: true, key: '+', code: 'NumpadAdd' }), 'in');
|
||||
assert.equal(zoomShortcutFromKeyboardEvent({ ctrlKey: true, key: 'Plus', code: 'Equal' }), 'in');
|
||||
assert.equal(zoomShortcutFromKeyboardEvent({ ctrlKey: true, key: '-', code: 'Minus' }), 'out');
|
||||
assert.equal(zoomShortcutFromKeyboardEvent({ metaKey: true, key: '0', code: 'Digit0' }), 'fit');
|
||||
assert.equal(zoomShortcutFromKeyboardEvent({ ctrlKey: true, key: '=', code: 'Equal', shiftKey: true }), 'in');
|
||||
@@ -18,6 +19,8 @@ test('zoom shortcut helper recognizes zoom in, out, and fit across event shapes'
|
||||
|
||||
test('zoom shortcut helper recognizes Electron before-input-event payloads', () => {
|
||||
assert.equal(zoomShortcutFromInputEvent({ control: true, key: '=', code: 'Equal' }), 'in');
|
||||
assert.equal(zoomShortcutFromInputEvent({ control: true, key: '=', code: 'Equal', shift: true }), 'in');
|
||||
assert.equal(zoomShortcutFromInputEvent({ control: true, key: 'Plus', code: 'Equal', shift: true }), 'in');
|
||||
assert.equal(zoomShortcutFromInputEvent({ control: true, key: '-', code: 'Minus' }), 'out');
|
||||
assert.equal(zoomShortcutFromInputEvent({ meta: true, key: '0', code: 'Digit0' }), 'fit');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user