Skip to content

Commit

Permalink
Null-check call result rather than function itself
Browse files Browse the repository at this point in the history
From the comment, it seems like this was supposed check for chords, rather than checking for the availability of `isChord`.

Signed-off-by: Andrew Casey <[email protected]>
Signed-off-by: Paul Maréchal <[email protected]>
  • Loading branch information
paul-marechal committed Apr 1, 2020
1 parent 9481af8 commit a7c47af
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
36 changes: 18 additions & 18 deletions examples/api-tests/src/monaco-api.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,24 @@ describe('Monaco API', async function () {
assert.deepStrictEqual({
label, ariaLabel, electronAccelerator, userSettingsLabel, WYSIWYG, chord, parts, dispatchParts
}, {
label: "Ctrl+Shift+Alt+K",
ariaLabel: "Ctrl+Shift+Alt+K",
electronAccelerator: null,
userSettingsLabel: "ctrl+shift+alt+K",
WYSIWYG: true,
chord: false,
parts: [{
altKey: true,
ctrlKey: true,
keyAriaLabel: "K",
keyLabel: "K",
metaKey: false,
shiftKey: true
}],
dispatchParts: [
"ctrl+shift+alt+K"
]
});
label: "Ctrl+Shift+Alt+K",
ariaLabel: "Ctrl+Shift+Alt+K",
electronAccelerator: "Ctrl+Shift+Alt+K",
userSettingsLabel: "ctrl+shift+alt+K",
WYSIWYG: true,
chord: false,
parts: [{
altKey: true,
ctrlKey: true,
keyAriaLabel: "K",
keyLabel: "K",
metaKey: false,
shiftKey: true
}],
dispatchParts: [
"ctrl+shift+alt+K"
]
});
} else {
assert.fail(`resolvedKeybinding must be of ${MonacoResolvedKeybinding.name} type`);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/monaco/src/browser/monaco-resolved-keybinding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class MonacoResolvedKeybinding extends monaco.keybindings.ResolvedKeybind
}

public getElectronAccelerator(): string | null {
if (this.isChord) {
if (this.isChord()) {
// Electron cannot handle chords
// eslint-disable-next-line no-null/no-null
return null;
Expand Down

0 comments on commit a7c47af

Please sign in to comment.