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 | // Tests that the markup view loads only as many nodes as specified |
michael@0 | 8 | // by the devtools.markup.pagesize preference and that pressing the "show all nodes" |
michael@0 | 9 | // actually shows the nodes |
michael@0 | 10 | |
michael@0 | 11 | const TEST_URL = TEST_URL_ROOT + "doc_markup_pagesize_02.html"; |
michael@0 | 12 | |
michael@0 | 13 | // Make sure nodes are hidden when there are more than 5 in a row |
michael@0 | 14 | Services.prefs.setIntPref("devtools.markup.pagesize", 5); |
michael@0 | 15 | |
michael@0 | 16 | let test = asyncTest(function*() { |
michael@0 | 17 | let {inspector} = yield addTab(TEST_URL).then(openInspector); |
michael@0 | 18 | |
michael@0 | 19 | info("Selecting the UL node"); |
michael@0 | 20 | yield clickContainer("ul", inspector); |
michael@0 | 21 | info("Reloading the page with the UL node selected will expand its children"); |
michael@0 | 22 | yield reloadPage(inspector); |
michael@0 | 23 | yield inspector.markup._waitForChildren(); |
michael@0 | 24 | |
michael@0 | 25 | info("Click on the 'show all nodes' button in the UL's list of children"); |
michael@0 | 26 | yield showAllNodes(inspector); |
michael@0 | 27 | |
michael@0 | 28 | assertAllNodesAreVisible(inspector); |
michael@0 | 29 | }); |
michael@0 | 30 | |
michael@0 | 31 | function showAllNodes(inspector) { |
michael@0 | 32 | let container = getContainerForRawNode("ul", inspector); |
michael@0 | 33 | let button = container.elt.querySelector("button"); |
michael@0 | 34 | ok(button, "All nodes button is here"); |
michael@0 | 35 | let win = button.ownerDocument.defaultView; |
michael@0 | 36 | |
michael@0 | 37 | EventUtils.sendMouseEvent({type: "click"}, button, win); |
michael@0 | 38 | return inspector.markup._waitForChildren(); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | function assertAllNodesAreVisible(inspector) { |
michael@0 | 42 | let ul = getNode("ul"); |
michael@0 | 43 | let container = getContainerForRawNode(ul, inspector); |
michael@0 | 44 | ok(!container.elt.querySelector("button"), "All nodes button isn't here anymore"); |
michael@0 | 45 | is(container.children.childNodes.length, ul.children.length); |
michael@0 | 46 | } |