test_TreeMap_01.html (1447B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 Test that the Tree Map correctly renders onto 2 managed canvases. 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 12 <script type="application/javascript" 13 src="chrome://global/content/third_party/d3/d3.js"> 14 </script> 15 </head> 16 <body> 17 <!-- Give the container height so that the whole tree is rendered. --> 18 <div id="container" style="height: 900px;"></div> 19 20 <pre id="test"> 21 <script src="head.js" type="application/javascript"></script> 22 <script type="application/javascript"> 23 "use strict"; 24 window.onload = async function() { 25 try { 26 const container = document.getElementById("container"); 27 28 await renderComponent(TreeMap(TEST_TREE_MAP_PROPS), container); 29 30 const treeMapContainer = container.querySelector(".tree-map-container"); 31 ok(treeMapContainer, "Component creates a container"); 32 33 const canvases = treeMapContainer.querySelectorAll("canvas"); 34 is(canvases.length, 2, "Creates 2 canvases"); 35 } catch (e) { 36 ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e)); 37 } finally { 38 SimpleTest.finish(); 39 } 40 }; 41 </script> 42 </pre> 43 </body> 44 </html>