Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 dbl-clicking on tag lines
9 const TEST_URL = TEST_URL_ROOT + "doc_markup_toggle.html";
11 let test = asyncTest(function*() {
12 let {inspector} = yield addTab(TEST_URL).then(openInspector);
14 info("Getting the container for the UL parent element");
15 let container = getContainerForRawNode("ul", inspector);
17 info("Dbl-clicking on the UL parent expander, and waiting for children");
18 let onChildren = waitForChildrenUpdated(inspector);
19 let onUpdated = inspector.once("inspector-updated");
20 EventUtils.synthesizeMouseAtCenter(container.tagLine, {clickCount: 2},
21 inspector.markup.doc.defaultView);
22 yield onChildren;
23 yield onUpdated;
25 info("Checking that child LI elements have been created");
26 for (let li of content.document.querySelectorAll("li")) {
27 ok(getContainerForRawNode(li, inspector),
28 "A container for the child LI element was created");
29 }
30 ok(container.expanded, "Parent UL container is expanded");
32 info("Dbl-clicking again on the UL expander");
33 // No need to wait, this is a local, synchronous operation where nodes are
34 // only hidden from the view, not destroyed
35 EventUtils.synthesizeMouseAtCenter(container.tagLine, {clickCount: 2},
36 inspector.markup.doc.defaultView);
38 info("Checking that child LI elements have been hidden");
39 for (let li of content.document.querySelectorAll("li")) {
40 let liContainer = getContainerForRawNode(li, inspector);
41 is(liContainer.elt.getClientRects().length, 0,
42 "The container for the child LI element was hidden");
43 }
44 ok(!container.expanded, "Parent UL container is collapsed");
45 });