Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
1 /* vim: set ts=2 et sw=2 tw=80: */
2 /* Any copyright is dedicated to the Public Domain.
3 http://creativecommons.org/publicdomain/zero/1.0/ */
5 "use strict";
7 // Test toggling (expand/collapse) elements by alt-clicking on twisties, which
8 // should expand all the descendants
10 const TEST_URL = TEST_URL_ROOT + "doc_markup_toggle.html";
12 let test = asyncTest(function*() {
13 let {inspector} = yield addTab(TEST_URL).then(openInspector);
15 info("Getting the container for the UL parent element");
16 let container = getContainerForRawNode("ul", inspector);
18 info("Alt-clicking on the UL parent expander, and waiting for children");
19 let onUpdated = inspector.once("inspector-updated");
20 EventUtils.synthesizeMouseAtCenter(container.expander, {altKey: true},
21 inspector.markup.doc.defaultView);
22 yield onUpdated;
23 yield waitForMultipleChildrenUpdates(inspector);
25 info("Checking that all nodes exist and are expanded");
26 for (let node of content.document.querySelectorAll("ul, li, span, em")) {
27 let nodeContainer = getContainerForRawNode(node, inspector);
28 ok(nodeContainer, "Container for node " + node.tagName + " exists");
29 ok(nodeContainer.expanded,
30 "Container for node " + node.tagName + " is expanded");
31 }
32 });
34 // The expand all operation of the markup-view calls itself recursively and
35 // there's not one event we can wait for to know when it's done
36 function* waitForMultipleChildrenUpdates(inspector) {
37 // As long as child updates are queued up while we wait for an update already
38 // wait again
39 if (inspector.markup._queuedChildUpdates &&
40 inspector.markup._queuedChildUpdates.size) {
41 yield waitForChildrenUpdated(inspector);
42 return yield waitForMultipleChildrenUpdates(inspector);
43 }
44 }