test_DominatorTree_02.html (1798B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 Test that we show a link to load more children when some (but not all) are loaded. 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> 15 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"); 23 24 const root = makeTestDominatorTreeNode({ moreChildrenAvailable: true }, [ 25 makeTestDominatorTreeNode({}), 26 ]); 27 ok(root.children); 28 ok(root.moreChildrenAvailable); 29 30 const expanded = new Set(); 31 expanded.add(root.nodeId); 32 33 await renderComponent(DominatorTreeComponent(immutableUpdate( 34 TEST_DOMINATOR_TREE_PROPS, { 35 dominatorTree: immutableUpdate(TEST_DOMINATOR_TREE_PROPS.dominatorTree, { 36 expanded, 37 root, 38 }), 39 })), container); 40 41 ok(container.querySelector(".more-children"), 42 "Should get a link to load more children"); 43 } catch (e) { 44 ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e)); 45 } finally { 46 SimpleTest.finish(); 47 } 48 }; 49 </script> 50 </pre> 51 </body> 52 </html>