Skip to content

Commit

Permalink
fix: keybindings unit test fialures
Browse files Browse the repository at this point in the history
  • Loading branch information
abose committed Jan 1, 2024
1 parent 167163f commit 20c2a17
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
9 changes: 9 additions & 0 deletions docs/generatedApiDocs/utils/FeatureGate-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ if(FeatureGate.isFeatureEnabled(FEATURE_NEW_COLORS)){

Returns **[boolean][3]**

## setFeatureEnabled

Sets the enabled state of a specific feature in the application.

### Parameters

* `featureName` **[string][2]** The name of the feature to be modified.
* `isEnabled` **[boolean][3]** A boolean flag indicating whether the feature should be enabled (true) or disabled (false).

[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function

[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"documentation": "https://github.com/adobe/brackets/wiki/Key-Bindings",
"overrides": {
"ctrl-2": "file.openFolder",
"Ctrl-2": "file.openFolder",
"ctrl-2": "file.newFile",
"Ctrl-2": "file.newFile",
"Ctrl-Alt-4": "view.toggleSidebar",
"Alt-Ctrl-4": "view.toggleSidebar"
}
Expand Down
2 changes: 1 addition & 1 deletion test/spec/KeyBindingManager-test-files/keymap.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"documentation": "https://github.com/adobe/brackets/wiki/Key-Bindings",
"overrides": {
"ctrl-2": "file.openFolder",
"ctrl-2": "file.newFile",
"Alt-Ctrl-Backspace": "view.toggleSidebar",
"ctrl-l": "navigate.gotoDefinition",
"Alt-Ctrl-L": null
Expand Down
2 changes: 1 addition & 1 deletion test/spec/KeyBindingManager-test-files/macKeymap.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"documentation": "https://github.com/adobe/brackets/wiki/Key-Bindings",
"overrides": {
"ctrl-2": "file.openFolder",
"ctrl-2": "file.newFile",
"Alt-Cmd-Backspace": "view.toggleSidebar",
"ctrl-l": "navigate.gotoDefinition",
"Alt-Cmd-L": null
Expand Down
12 changes: 6 additions & 6 deletions test/spec/KeyBindingManager-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ define(function (require, exports, module) {
"Alt-Shift-Down": "edit.addCursorToNextLine",
"Alt-Shift-Up": "edit.addCursorToPrevLine",
"F8": "navigate.gotoFirstProblem",
"Ctrl-Alt-O": "file.openFolder",
"Ctrl-1": "file.newFile",
"Ctrl-Alt-H": "view.toggleSidebar",
"Ctrl-Shift-O": "navigate.quickOpen",
"Ctrl-T": "navigate.gotoDefinition"
Expand All @@ -60,7 +60,7 @@ define(function (require, exports, module) {
"Alt-Shift-Down": "edit.addCursorToNextLine",
"Alt-Shift-Up": "edit.addCursorToPrevLine",
"Cmd-'": "navigate.gotoFirstProblem",
"Alt-Cmd-O": "file.openFolder",
"Cmd-1": "file.newFile",
"Shift-Cmd-H": "view.toggleSidebar",
"Shift-Cmd-O": "navigate.quickOpen",
"Cmd-T": "navigate.gotoDefinition"
Expand Down Expand Up @@ -618,7 +618,7 @@ define(function (require, exports, module) {
called = true;
var msgPrefix = Strings.ERROR_NONEXISTENT_COMMANDS.replace("{0}", "");
expect(message).toMatch(msgPrefix);
expect(message).toMatch("file.openFolder");
expect(message).toMatch("file.newFile");
expect(message).toMatch("view.toggleSidebar");
return {done: function (callback) { callback(Dialogs.DIALOG_BTN_OK); } };
};
Expand Down Expand Up @@ -652,7 +652,7 @@ define(function (require, exports, module) {
let reassignedKey1 = (platform === "mac") ? "Alt-Cmd-Backspace" : "Ctrl-Alt-Backspace",
reassignedKey2 = (platform === "mac") ? "Cmd-T" : "Ctrl-T";
expect(called).toBeFalse();
expect(keymap["Ctrl-2"].commandID).toEqual("file.openFolder");
expect(keymap["Ctrl-2"].commandID).toEqual("file.newFile");
expect(keymap["Alt-Cmd-O"]).toBeFalsy();
expect(keymap["Alt-Ctrl-O"]).toBeFalsy();

Expand Down Expand Up @@ -692,7 +692,7 @@ define(function (require, exports, module) {

var keymap = KeyBindingManager.getKeymap(),
reassignedKey1 = (platform === "mac") ? "Alt-Cmd-Backspace" : "Ctrl-Alt-Backspace",
reassignedKey2 = (platform === "mac") ? "Alt-Cmd-O" : "Ctrl-Alt-O",
reassignedKey2 = "Ctrl-1",
reassignedKey3 = (platform === "mac") ? "Alt-Cmd-L" : "Ctrl-Alt-L";

expect(called).toBeFalse();
Expand All @@ -702,7 +702,7 @@ define(function (require, exports, module) {
expect(keymap[reassignedKey1]).toBeFalsy();

// Default key binding for "file.openFolder" is restored.
expect(keymap[reassignedKey2].commandID).toEqual("file.openFolder");
expect(keymap[reassignedKey2].commandID).toEqual("file.newFile");

expect(keymap["Ctrl-L"].commandID).toEqual("navigate.gotoDefinition");
expect(keymap[reassignedKey3]).toBeFalsy();
Expand Down

0 comments on commit 20c2a17

Please sign in to comment.