summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/test/browser_inspector_expand-collapse.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_expand-collapse.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_expand-collapse.js')
-rw-r--r--devtools/client/inspector/test/browser_inspector_expand-collapse.js64
1 files changed, 64 insertions, 0 deletions
diff --git a/devtools/client/inspector/test/browser_inspector_expand-collapse.js b/devtools/client/inspector/test/browser_inspector_expand-collapse.js
new file mode 100644
index 000000000..3b1dcb6b2
--- /dev/null
+++ b/devtools/client/inspector/test/browser_inspector_expand-collapse.js
@@ -0,0 +1,64 @@
+/* vim: set ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Tests that context menu items exapnd all and collapse are shown properly.
+
+const TEST_URL = "data:text/html;charset=utf-8," +
+ "<div id='parent-node'><div id='child-node'></div></div>";
+
+add_task(function* () {
+ // Test is often exceeding time-out threshold, similar to Bug 1137765
+ requestLongerTimeout(2);
+
+ let {inspector} = yield openInspectorForURL(TEST_URL);
+
+ info("Selecting the parent node");
+
+ let front = yield getNodeFrontForSelector("#parent-node", inspector);
+
+ yield selectNode(front, inspector);
+
+ info("Simulating context menu click on the selected node container.");
+ let allMenuItems = openContextMenuAndGetAllItems(inspector, {
+ target: getContainerForNodeFront(front, inspector).tagLine,
+ });
+ let nodeMenuCollapseElement =
+ allMenuItems.find(item => item.id === "node-menu-collapse");
+ let nodeMenuExpandElement =
+ allMenuItems.find(item => item.id === "node-menu-expand");
+
+ ok(nodeMenuCollapseElement.disabled, "Collapse option is disabled");
+ ok(!nodeMenuExpandElement.disabled, "ExpandAll option is enabled");
+
+ info("Testing whether expansion works properly");
+ nodeMenuExpandElement.click();
+
+ info("Waiting for expansion to occur");
+ yield waitForMultipleChildrenUpdates(inspector);
+ let markUpContainer = getContainerForNodeFront(front, inspector);
+ ok(markUpContainer.expanded, "node has been successfully expanded");
+
+ // reselecting node after expansion
+ yield selectNode(front, inspector);
+
+ info("Testing whether collapse works properly");
+ info("Simulating context menu click on the selected node container.");
+ allMenuItems = openContextMenuAndGetAllItems(inspector, {
+ target: getContainerForNodeFront(front, inspector).tagLine,
+ });
+ nodeMenuCollapseElement =
+ allMenuItems.find(item => item.id === "node-menu-collapse");
+ nodeMenuExpandElement =
+ allMenuItems.find(item => item.id === "node-menu-expand");
+
+ ok(!nodeMenuCollapseElement.disabled, "Collapse option is enabled");
+ ok(!nodeMenuExpandElement.disabled, "ExpandAll option is enabled");
+ nodeMenuCollapseElement.click();
+
+ info("Waiting for collapse to occur");
+ yield waitForMultipleChildrenUpdates(inspector);
+ ok(!markUpContainer.expanded, "node has been successfully collapsed");
+});