tor-browser

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

test_tree_02.html (1521B)


      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 that collapsed subtrees aren't rendered.
      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(TEST_TREE_INTERFACE), window.document.body);
     29 
     30    isAccessibleTree(tree);
     31    TEST_TREE.expanded = new Set("MNO".split(""));
     32    await forceRender(tree);
     33 
     34    isRenderedTree(document.body.textContent, [
     35      "A:false",
     36      "M:false",
     37      "-N:false",
     38      "--O:false",
     39    ], "Collapsed subtrees shouldn't be rendered");
     40  } catch(e) {
     41    ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
     42  } finally {
     43    SimpleTest.finish();
     44  }
     45 };
     46 </script>
     47 </pre>
     48 </body>
     49 </html>