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.
michael@0 | 1 | /* vim: set ts=2 et sw=2 tw=80: */ |
michael@0 | 2 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 4 | |
michael@0 | 5 | "use strict"; |
michael@0 | 6 | |
michael@0 | 7 | // Test toggling (expand/collapse) elements by clicking on twisties |
michael@0 | 8 | |
michael@0 | 9 | const TEST_URL = TEST_URL_ROOT + "doc_markup_toggle.html"; |
michael@0 | 10 | |
michael@0 | 11 | let test = asyncTest(function*() { |
michael@0 | 12 | let {inspector} = yield addTab(TEST_URL).then(openInspector); |
michael@0 | 13 | |
michael@0 | 14 | info("Getting the container for the UL parent element"); |
michael@0 | 15 | let container = getContainerForRawNode("ul", inspector); |
michael@0 | 16 | |
michael@0 | 17 | info("Clicking on the UL parent expander, and waiting for children"); |
michael@0 | 18 | let onChildren = waitForChildrenUpdated(inspector); |
michael@0 | 19 | let onUpdated = inspector.once("inspector-updated"); |
michael@0 | 20 | EventUtils.synthesizeMouseAtCenter(container.expander, {}, |
michael@0 | 21 | inspector.markup.doc.defaultView); |
michael@0 | 22 | yield onChildren; |
michael@0 | 23 | yield onUpdated; |
michael@0 | 24 | |
michael@0 | 25 | info("Checking that child LI elements have been created"); |
michael@0 | 26 | for (let li of content.document.querySelectorAll("li")) { |
michael@0 | 27 | ok(getContainerForRawNode(li, inspector), |
michael@0 | 28 | "A container for the child LI element was created"); |
michael@0 | 29 | } |
michael@0 | 30 | ok(container.expanded, "Parent UL container is expanded"); |
michael@0 | 31 | |
michael@0 | 32 | info("Clicking again on the UL expander"); |
michael@0 | 33 | // No need to wait, this is a local, synchronous operation where nodes are |
michael@0 | 34 | // only hidden from the view, not destroyed |
michael@0 | 35 | EventUtils.synthesizeMouseAtCenter(container.expander, {}, |
michael@0 | 36 | inspector.markup.doc.defaultView); |
michael@0 | 37 | |
michael@0 | 38 | info("Checking that child LI elements have been hidden"); |
michael@0 | 39 | for (let li of content.document.querySelectorAll("li")) { |
michael@0 | 40 | let liContainer = getContainerForRawNode(li, inspector); |
michael@0 | 41 | is(liContainer.elt.getClientRects().length, 0, |
michael@0 | 42 | "The container for the child LI element was hidden"); |
michael@0 | 43 | } |
michael@0 | 44 | ok(!container.expanded, "Parent UL container is collapsed"); |
michael@0 | 45 | }); |