Bug 1874684 - Part 4: Prefer const references instead of copying Instant values....
[gecko.git] / devtools / client / memory / test / chrome / test_CensusTreeItem_01.html
blob21d900b66894e370592b5ccf32a6810e73025327
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 Test that children pointers show up at the correct times.
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Tree component test</title>
9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
11 </head>
12 <body>
13 <!-- Give the container height so that the whole tree is rendered. -->
14 <div id="container" style="height: 900px;"></div>
16 <pre id="test">
17 <script src="head.js" type="application/javascript"></script>
18 <script type="application/javascript">
19 "use strict";
20 window.onload = async function() {
21 try {
22 const container = document.getElementById("container");
24 await renderComponent(CensusTreeItem(immutableUpdate(TEST_CENSUS_TREE_ITEM_PROPS, {
25 inverted: true,
26 depth: 0,
27 })), container);
29 ok(!container.querySelector(".children-pointer"),
30 "Don't show children pointer for roots when we are inverted");
32 await renderComponent(CensusTreeItem(immutableUpdate(TEST_CENSUS_TREE_ITEM_PROPS, {
33 inverted: true,
34 depth: 1,
35 })), container);
37 ok(container.querySelector(".children-pointer"),
38 "Do show children pointer for non-roots when we are inverted");
40 await renderComponent(CensusTreeItem(immutableUpdate(TEST_CENSUS_TREE_ITEM_PROPS, {
41 inverted: false,
42 item: immutableUpdate(TEST_CENSUS_TREE_ITEM_PROPS.item, { children: undefined }),
43 })), container);
45 ok(!container.querySelector(".children-pointer"),
46 "Don't show children pointer when non-inverted and no children");
48 await renderComponent(CensusTreeItem(immutableUpdate(TEST_CENSUS_TREE_ITEM_PROPS, {
49 inverted: false,
50 depth: 0,
51 item: immutableUpdate(TEST_CENSUS_TREE_ITEM_PROPS.item, { children: [{}] }),
52 })), container);
54 ok(container.querySelector(".children-pointer"),
55 "Do show children pointer when non-inverted and have children");
56 } catch (e) {
57 ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
58 } finally {
59 SimpleTest.finish();
62 </script>
63 </pre>
64 </body>
65 </html>