tor-browser

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

test_Toolbar_01.html (1666B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 Test that the Toolbar component shows the view switcher only at the appropriate 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    <div id="container"></div>
     14    <pre id="test">
     15        <script src="head.js" type="application/javascript"></script>
     16        <script type="application/javascript">
     17         "use strict";
     18         window.onload = async function() {
     19           try {
     20             const container = document.getElementById("container");
     21 
     22             // Census and dominator tree views.
     23 
     24             for (const view of [viewState.CENSUS, viewState.DOMINATOR_TREE]) {
     25               await renderComponent(Toolbar(immutableUpdate(TEST_TOOLBAR_PROPS, {
     26                 view: { state: view },
     27               })), container);
     28 
     29               ok(container.querySelector("#select-view"),
     30                  `The view selector is shown in view = ${view}`);
     31             }
     32 
     33             await renderComponent(Toolbar(immutableUpdate(TEST_TOOLBAR_PROPS, {
     34               view: { state: viewState.DIFFING },
     35             })), container);
     36 
     37             ok(!container.querySelector("#select-view"),
     38                "The view selector is NOT shown in the DIFFING view");
     39           } catch (e) {
     40             ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
     41           } finally {
     42             SimpleTest.finish();
     43           }
     44         };
     45        </script>
     46    </pre>
     47 </body>
     48 </html>