test_DominatorTree_01.html (1873B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 Test that we show a place holder for a subtree we are lazily fetching. 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 ok(!root.children); 26 27 const expanded = new Set(); 28 expanded.add(root.nodeId); 29 30 await renderComponent(DominatorTreeComponent(immutableUpdate( 31 TEST_DOMINATOR_TREE_PROPS, { 32 dominatorTree: immutableUpdate(TEST_DOMINATOR_TREE_PROPS.dominatorTree, { 33 expanded, 34 root, 35 state: dominatorTreeState.INCREMENTAL_FETCHING, 36 activeFetchRequestCount: 1, 37 }), 38 })), container); 39 40 ok(container.querySelector(".subtree-fetching"), 41 "Expanded nodes with more children available, but no children " + 42 "loaded, should get a placeholder"); 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>