michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: "use strict"; michael@0: michael@0: // Test toggling (expand/collapse) elements by dbl-clicking on tag lines michael@0: michael@0: const TEST_URL = TEST_URL_ROOT + "doc_markup_toggle.html"; michael@0: michael@0: let test = asyncTest(function*() { michael@0: let {inspector} = yield addTab(TEST_URL).then(openInspector); michael@0: michael@0: info("Getting the container for the UL parent element"); michael@0: let container = getContainerForRawNode("ul", inspector); michael@0: michael@0: info("Dbl-clicking on the UL parent expander, and waiting for children"); michael@0: let onChildren = waitForChildrenUpdated(inspector); michael@0: let onUpdated = inspector.once("inspector-updated"); michael@0: EventUtils.synthesizeMouseAtCenter(container.tagLine, {clickCount: 2}, michael@0: inspector.markup.doc.defaultView); michael@0: yield onChildren; michael@0: yield onUpdated; michael@0: michael@0: info("Checking that child LI elements have been created"); michael@0: for (let li of content.document.querySelectorAll("li")) { michael@0: ok(getContainerForRawNode(li, inspector), michael@0: "A container for the child LI element was created"); michael@0: } michael@0: ok(container.expanded, "Parent UL container is expanded"); michael@0: michael@0: info("Dbl-clicking again on the UL expander"); michael@0: // No need to wait, this is a local, synchronous operation where nodes are michael@0: // only hidden from the view, not destroyed michael@0: EventUtils.synthesizeMouseAtCenter(container.tagLine, {clickCount: 2}, michael@0: inspector.markup.doc.defaultView); michael@0: michael@0: info("Checking that child LI elements have been hidden"); michael@0: for (let li of content.document.querySelectorAll("li")) { michael@0: let liContainer = getContainerForRawNode(li, inspector); michael@0: is(liContainer.elt.getClientRects().length, 0, michael@0: "The container for the child LI element was hidden"); michael@0: } michael@0: ok(!container.expanded, "Parent UL container is collapsed"); michael@0: });