summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/markup/test/browser_markup_toggle_01.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/markup/test/browser_markup_toggle_01.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/markup/test/browser_markup_toggle_01.js')
-rw-r--r--devtools/client/inspector/markup/test/browser_markup_toggle_01.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/devtools/client/inspector/markup/test/browser_markup_toggle_01.js b/devtools/client/inspector/markup/test/browser_markup_toggle_01.js
new file mode 100644
index 000000000..a481f685e
--- /dev/null
+++ b/devtools/client/inspector/markup/test/browser_markup_toggle_01.js
@@ -0,0 +1,58 @@
+/* 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";
+
+// Test toggling (expand/collapse) elements by clicking on twisties
+
+const TEST_URL = URL_ROOT + "doc_markup_toggle.html";
+
+add_task(function* () {
+ let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
+
+ info("Getting the container for the html element");
+ let container = yield getContainerForSelector("html", inspector);
+ ok(container.mustExpand, "HTML element mustExpand");
+ ok(container.canExpand, "HTML element canExpand");
+ is(container.expander.style.visibility, "hidden", "HTML twisty is hidden");
+
+ info("Getting the container for the UL parent element");
+ container = yield getContainerForSelector("ul", inspector);
+ ok(!container.mustExpand, "UL element !mustExpand");
+ ok(container.canExpand, "UL element canExpand");
+ is(container.expander.style.visibility, "visible", "HTML twisty is visible");
+
+ info("Clicking on the UL parent expander, and waiting for children");
+ let onChildren = waitForChildrenUpdated(inspector);
+ let onUpdated = inspector.once("inspector-updated");
+ EventUtils.synthesizeMouseAtCenter(container.expander, {},
+ inspector.markup.doc.defaultView);
+ yield onChildren;
+ yield onUpdated;
+
+ info("Checking that child LI elements have been created");
+ let numLi = yield testActor.getNumberOfElementMatches("li");
+ for (let i = 0; i < numLi; i++) {
+ let liContainer = yield getContainerForSelector(
+ `li:nth-child(${i + 1})`, inspector);
+ ok(liContainer, "A container for the child LI element was created");
+ }
+ ok(container.expanded, "Parent UL container is expanded");
+
+ info("Clicking again on the UL expander");
+ // No need to wait, this is a local, synchronous operation where nodes are
+ // only hidden from the view, not destroyed
+ EventUtils.synthesizeMouseAtCenter(container.expander, {},
+ inspector.markup.doc.defaultView);
+
+ info("Checking that child LI elements have been hidden");
+ numLi = yield testActor.getNumberOfElementMatches("li");
+ for (let i = 0; i < numLi; i++) {
+ let liContainer = yield getContainerForSelector(
+ `li:nth-child(${i + 1})`, inspector);
+ is(liContainer.elt.getClientRects().length, 0,
+ "The container for the child LI element was hidden");
+ }
+ ok(!container.expanded, "Parent UL container is collapsed");
+});