tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_Heap_01.html (1709B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 Test that rendering a dominator tree error is handled correctly.
      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    <div id="container"></div>
     14    <pre id="test">
     15        <script src="head.js" type="application/javascript"></script>
     16 
     17        <script type="application/javascript">
     18         "use strict";
     19         window.onload = async function() {
     20           try {
     21             ok(React, "Should get React");
     22             ok(Heap, "Should get Heap");
     23 
     24             const errorMessage = "Something went wrong!";
     25             const container = document.getElementById("container");
     26 
     27             const props = immutableUpdate(TEST_HEAP_PROPS, {
     28               view: { state: viewState.DOMINATOR_TREE },
     29               snapshot: immutableUpdate(TEST_HEAP_PROPS.snapshot, {
     30                 dominatorTree: {
     31                   error: new Error(errorMessage),
     32                   state: dominatorTreeState.ERROR,
     33                 },
     34               }),
     35             });
     36 
     37             await renderComponent(Heap(props), container);
     38 
     39             ok(container.querySelector(".error"), "Should render an error view");
     40             ok(container.textContent.includes(errorMessage),
     41                "Should see our error message");
     42           } catch (e) {
     43             ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
     44           } finally {
     45             SimpleTest.finish();
     46           }
     47         };
     48        </script>
     49    </pre>
     50 </body>
     51 </html>