|
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/ */ |
|
4 |
|
5 "use strict"; |
|
6 |
|
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 |
|
10 |
|
11 const TEST_URL = TEST_URL_ROOT + "doc_markup_pagesize_02.html"; |
|
12 |
|
13 // Make sure nodes are hidden when there are more than 5 in a row |
|
14 Services.prefs.setIntPref("devtools.markup.pagesize", 5); |
|
15 |
|
16 let test = asyncTest(function*() { |
|
17 let {inspector} = yield addTab(TEST_URL).then(openInspector); |
|
18 |
|
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(); |
|
24 |
|
25 info("Click on the 'show all nodes' button in the UL's list of children"); |
|
26 yield showAllNodes(inspector); |
|
27 |
|
28 assertAllNodesAreVisible(inspector); |
|
29 }); |
|
30 |
|
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; |
|
36 |
|
37 EventUtils.sendMouseEvent({type: "click"}, button, win); |
|
38 return inspector.markup._waitForChildren(); |
|
39 } |
|
40 |
|
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 } |