summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/new/test/mochitest/browser_dbg-sources.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/debugger/new/test/mochitest/browser_dbg-sources.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/debugger/new/test/mochitest/browser_dbg-sources.js')
-rw-r--r--devtools/client/debugger/new/test/mochitest/browser_dbg-sources.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/devtools/client/debugger/new/test/mochitest/browser_dbg-sources.js b/devtools/client/debugger/new/test/mochitest/browser_dbg-sources.js
new file mode 100644
index 000000000..64b7f56ae
--- /dev/null
+++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-sources.js
@@ -0,0 +1,58 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Tests that the source tree works.
+
+function* waitForSourceCount(dbg, i) {
+ // We are forced to wait until the DOM nodes appear because the
+ // source tree batches its rendering.
+ yield waitUntil(() => {
+ return findAllElements(dbg, "sourceNodes").length === i;
+ });
+}
+
+add_task(function* () {
+ const dbg = yield initDebugger("doc-sources.html");
+ const { selectors: { getSelectedSource }, getState } = dbg;
+
+ // Expand nodes and make sure more sources appear.
+ is(findAllElements(dbg, "sourceNodes").length, 2);
+
+ clickElement(dbg, "sourceArrow", 2);
+ is(findAllElements(dbg, "sourceNodes").length, 7);
+
+ clickElement(dbg, "sourceArrow", 3);
+ is(findAllElements(dbg, "sourceNodes").length, 8);
+
+ // Select a source.
+ ok(!findElementWithSelector(dbg, ".sources-list .focused"),
+ "Source is not focused");
+ const selected = waitForDispatch(dbg, "SELECT_SOURCE");
+ clickElement(dbg, "sourceNode", 4);
+ yield selected;
+ ok(findElementWithSelector(dbg, ".sources-list .focused"),
+ "Source is focused");
+ ok(getSelectedSource(getState()).get("url").includes("nested-source.js"),
+ "The right source is selected");
+
+ // Make sure new sources appear in the list.
+ ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
+ const script = content.document.createElement("script");
+ script.src = "math.min.js";
+ content.document.body.appendChild(script);
+ });
+
+ yield waitForSourceCount(dbg, 9);
+ is(findElement(dbg, "sourceNode", 7).querySelector("span").innerText,
+ "math.min.js",
+ "The dynamic script exists");
+
+ // Make sure named eval sources appear in the list.
+ ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
+ content.eval("window.evaledFunc = function() {} //# sourceURL=evaled.js");
+ });
+ yield waitForSourceCount(dbg, 11);
+ is(findElement(dbg, "sourceNode", 2).querySelector("span").innerText,
+ "evaled.js",
+ "The eval script exists");
+});