browser/devtools/markupview/test/browser_markupview_pagesize_02.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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

mercurial