summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/test/browser_inspector_search-05.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-05.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-05.js')
-rw-r--r--devtools/client/inspector/test/browser_inspector_search-05.js93
1 files changed, 93 insertions, 0 deletions
diff --git a/devtools/client/inspector/test/browser_inspector_search-05.js b/devtools/client/inspector/test/browser_inspector_search-05.js
new file mode 100644
index 000000000..542d0ccc5
--- /dev/null
+++ b/devtools/client/inspector/test/browser_inspector_search-05.js
@@ -0,0 +1,93 @@
+/* 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 that when search results contain suggestions for nodes in other
+// frames, selecting these suggestions actually selects the right nodes.
+
+requestLongerTimeout(2);
+
+const IFRAME_SRC = "doc_inspector_search.html";
+const NESTED_IFRAME_SRC = `
+ <button id="b1">Nested button</button>
+ <iframe id="iframe-4" src="${URL_ROOT + IFRAME_SRC}"></iframe>
+`;
+const TEST_URL = `
+ <iframe id="iframe-1" src="${URL_ROOT + IFRAME_SRC}"></iframe>
+ <iframe id="iframe-2" src="${URL_ROOT + IFRAME_SRC}"></iframe>
+ <iframe id="iframe-3"
+ src="data:text/html;charset=utf-8,${encodeURI(NESTED_IFRAME_SRC)}">
+ </iframe>
+`;
+
+add_task(function* () {
+ let {inspector} = yield openInspectorForURL(
+ "data:text/html;charset=utf-8," + encodeURI(TEST_URL));
+
+ info("Focus the search box");
+ yield focusSearchBoxUsingShortcut(inspector.panelWin);
+
+ info("Enter # to search for all ids");
+ let processingDone = once(inspector.searchSuggestions, "processing-done");
+ EventUtils.synthesizeKey("#", {}, inspector.panelWin);
+ yield processingDone;
+
+ info("Wait for search query to complete");
+ yield inspector.searchSuggestions._lastQuery;
+
+ info("Press tab to fill the search input with the first suggestion");
+ processingDone = once(inspector.searchSuggestions, "processing-done");
+ EventUtils.synthesizeKey("VK_TAB", {}, inspector.panelWin);
+ yield processingDone;
+
+ info("Press enter and expect a new selection");
+ let onSelect = inspector.once("inspector-updated");
+ EventUtils.synthesizeKey("VK_RETURN", {}, 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");
+ onSelect = inspector.once("inspector-updated");
+ EventUtils.synthesizeKey("VK_RETURN", {}, inspector.panelWin);
+ yield onSelect;
+
+ yield checkCorrectButton(inspector, "#iframe-4");
+
+ 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-1");
+});
+
+let checkCorrectButton = Task.async(function* (inspector, frameSelector) {
+ let {walker} = inspector;
+ let node = inspector.selection.nodeFront;
+
+ ok(node.id, "b1", "The selected node is #b1");
+ ok(node.tagName.toLowerCase(), "button",
+ "The selected node is <button>");
+
+ let selectedNodeDoc = yield walker.document(node);
+ let iframe = yield walker.multiFrameQuerySelectorAll(frameSelector);
+ iframe = yield iframe.item(0);
+ let iframeDoc = (yield walker.children(iframe)).nodes[0];
+ is(selectedNodeDoc, iframeDoc, "The selected node is in " + frameSelector);
+});