summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/test/browser_inspector_search-selection.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/client/inspector/test/browser_inspector_search-selection.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/inspector/test/browser_inspector_search-selection.js')
-rw-r--r--devtools/client/inspector/test/browser_inspector_search-selection.js62
1 files changed, 62 insertions, 0 deletions
diff --git a/devtools/client/inspector/test/browser_inspector_search-selection.js b/devtools/client/inspector/test/browser_inspector_search-selection.js
new file mode 100644
index 000000000..99f1e34bb
--- /dev/null
+++ b/devtools/client/inspector/test/browser_inspector_search-selection.js
@@ -0,0 +1,62 @@
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+"use strict";
+
+// Testing navigation between nodes in search results
+const {AppConstants} = require("resource://gre/modules/AppConstants.jsm");
+
+const TEST_URL = URL_ROOT + "doc_inspector_search.html";
+
+add_task(function* () {
+ let {inspector} = yield openInspectorForURL(TEST_URL);
+
+ info("Focus the search box");
+ yield focusSearchBoxUsingShortcut(inspector.panelWin);
+
+ info("Enter body > p to search");
+ let processingDone = once(inspector.searchSuggestions, "processing-done");
+ EventUtils.sendString("body > p", inspector.panelWin);
+ yield processingDone;
+
+ info("Wait for search query to complete");
+ yield inspector.searchSuggestions._lastQuery;
+
+ let msg = "Press enter and expect a new selection";
+ yield sendKeyAndCheck(inspector, msg, "VK_RETURN", {}, "#p1");
+
+ msg = "Press enter to cycle through multiple nodes";
+ yield sendKeyAndCheck(inspector, msg, "VK_RETURN", {}, "#p2");
+
+ msg = "Press shift-enter to select the previous node";
+ yield sendKeyAndCheck(inspector, msg, "VK_RETURN", { shiftKey: true }, "#p1");
+
+ if (AppConstants.platform === "macosx") {
+ msg = "Press meta-g to cycle through multiple nodes";
+ yield sendKeyAndCheck(inspector, msg, "VK_G", { metaKey: true }, "#p2");
+
+ msg = "Press shift+meta-g to select the previous node";
+ yield sendKeyAndCheck(inspector, msg, "VK_G",
+ { metaKey: true, shiftKey: true }, "#p1");
+ } else {
+ msg = "Press ctrl-g to cycle through multiple nodes";
+ yield sendKeyAndCheck(inspector, msg, "VK_G", { ctrlKey: true }, "#p2");
+
+ msg = "Press shift+ctrl-g to select the previous node";
+ yield sendKeyAndCheck(inspector, msg, "VK_G",
+ { ctrlKey: true, shiftKey: true }, "#p1");
+ }
+});
+
+let sendKeyAndCheck = Task.async(function* (inspector, description, key,
+ modifiers, expectedId) {
+ info(description);
+ let onSelect = inspector.once("inspector-updated");
+ EventUtils.synthesizeKey(key, modifiers, inspector.panelWin);
+ yield onSelect;
+
+ let selectedNode = inspector.selection.nodeFront;
+ info(selectedNode.id + " is selected with text " + inspector.searchBox.value);
+ let targetNode = yield getNodeFront(expectedId, inspector);
+ is(selectedNode, targetNode, "Correct node " + expectedId + " is selected");
+});