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: // Tests that the markup view loads only as many nodes as specified michael@0: // by the devtools.markup.pagesize preference and that pressing the "show all nodes" michael@0: // actually shows the nodes michael@0: michael@0: const TEST_URL = TEST_URL_ROOT + "doc_markup_pagesize_02.html"; michael@0: michael@0: // Make sure nodes are hidden when there are more than 5 in a row michael@0: Services.prefs.setIntPref("devtools.markup.pagesize", 5); michael@0: michael@0: let test = asyncTest(function*() { michael@0: let {inspector} = yield addTab(TEST_URL).then(openInspector); michael@0: michael@0: info("Selecting the UL node"); michael@0: yield clickContainer("ul", inspector); michael@0: info("Reloading the page with the UL node selected will expand its children"); michael@0: yield reloadPage(inspector); michael@0: yield inspector.markup._waitForChildren(); michael@0: michael@0: info("Click on the 'show all nodes' button in the UL's list of children"); michael@0: yield showAllNodes(inspector); michael@0: michael@0: assertAllNodesAreVisible(inspector); michael@0: }); michael@0: michael@0: function showAllNodes(inspector) { michael@0: let container = getContainerForRawNode("ul", inspector); michael@0: let button = container.elt.querySelector("button"); michael@0: ok(button, "All nodes button is here"); michael@0: let win = button.ownerDocument.defaultView; michael@0: michael@0: EventUtils.sendMouseEvent({type: "click"}, button, win); michael@0: return inspector.markup._waitForChildren(); michael@0: } michael@0: michael@0: function assertAllNodesAreVisible(inspector) { michael@0: let ul = getNode("ul"); michael@0: let container = getContainerForRawNode(ul, inspector); michael@0: ok(!container.elt.querySelector("button"), "All nodes button isn't here anymore"); michael@0: is(container.children.childNodes.length, ul.children.length); michael@0: }