tor-browser

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

test_tree_03.html (1509B)


      1 <!-- This Source Code Form is subject to the terms of the Mozilla Public
      2   - License, v. 2.0. If a copy of the MPL was not distributed with this
      3   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
      4 <!DOCTYPE HTML>
      5 <html>
      6 <!--
      7 Test Tree's autoExpandDepth.
      8 -->
      9 <head>
     10  <meta charset="utf-8">
     11  <title>Tree component test</title>
     12  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
     13  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
     14 </head>
     15 <body>
     16 <pre id="test">
     17 <script src="head.js" type="application/javascript"></script>
     18 <script type="application/javascript">
     19 
     20 'use strict'
     21 
     22 window.onload = async function () {
     23  try {
     24    const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");
     25    const React = browserRequire("devtools/client/shared/vendor/react");
     26    const Tree = React.createFactory(browserRequire("devtools/client/shared/components/VirtualizedTree"));
     27 
     28    const tree = ReactDOM.render(Tree(Object.assign({}, TEST_TREE_INTERFACE, {
     29      autoExpandDepth: 1
     30    })), window.document.body);
     31 
     32    isAccessibleTree(tree);
     33    isRenderedTree(document.body.textContent, [
     34      "A:false",
     35      "-B:false",
     36      "-C:false",
     37      "-D:false",
     38      "M:false",
     39      "-N:false",
     40    ], "Tree should be auto expanded one level");
     41  } catch(e) {
     42    ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
     43  } finally {
     44    SimpleTest.finish();
     45  }
     46 };
     47 </script>
     48 </pre>
     49 </body>
     50 </html>