Bug 1259060 - Add shift+enter to navigate to previous result in inspector search;r=bgrins
MozReview-Commit-ID: 6Y8tz7dML5s
--- a/devtools/client/inspector/inspector-search.js
+++ b/devtools/client/inspector/inspector-search.js
@@ -102,17 +102,17 @@ InspectorSearch.prototype = {
_onKeyDown: function(event) {
if (this.searchBox.value.length === 0) {
this.searchBox.removeAttribute("filled");
} else {
this.searchBox.setAttribute("filled", true);
}
if (event.keyCode === event.DOM_VK_RETURN) {
- this._onSearch();
+ this._onSearch(event.shiftKey);
} if (event.keyCode === Ci.nsIDOMKeyEvent.DOM_VK_G && event.metaKey) {
this._onSearch(event.shiftKey);
event.preventDefault();
}
}
};
/**
--- a/devtools/client/inspector/test/browser_inspector_search-05.js
+++ b/devtools/client/inspector/test/browser_inspector_search-05.js
@@ -48,16 +48,30 @@ add_task(function* () {
info("Press enter to cycle through multiple nodes matching this suggestion");
onSelect = inspector.once("inspector-updated");
EventUtils.synthesizeKey("VK_RETURN", {}, inspector.panelWin);
yield onSelect;
yield checkCorrectButton(inspector, "#iframe-2");
+ info("Press shift-enter to select the previous node matching this suggestion");
+ onSelect = inspector.once("inspector-updated");
+ EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true }, inspector.panelWin);
+ yield onSelect;
+
+ yield checkCorrectButton(inspector, "#iframe-1");
+
+ info("Press enter to cycle through multiple nodes matching this suggestion");
+ onSelect = inspector.once("inspector-updated");
+ EventUtils.synthesizeKey("VK_RETURN", {}, inspector.panelWin);
+ yield onSelect;
+
+ yield checkCorrectButton(inspector, "#iframe-2");
+
info("Press enter to cycle through multiple nodes matching this suggestion");
onSelect = inspector.once("inspector-updated");
EventUtils.synthesizeKey("VK_RETURN", {}, inspector.panelWin);
yield onSelect;
yield checkCorrectButton(inspector, "#iframe-3");
info("Press enter to cycle through multiple nodes matching this suggestion");