tor-browser

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

test_tree_10.html (1783B)


      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 when an item in the Tree component is expanded or collapsed the appropriate event handler fires.
      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  <link rel="stylesheet" href="chrome://devtools/skin/light-theme.css" type="text/css">
     15 </head>
     16 <body>
     17 <pre id="test">
     18 <script src="head.js" type="application/javascript"></script>
     19 <script type="application/javascript">
     20 
     21 'use strict'
     22 
     23 window.onload = async function () {
     24  try {
     25    const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");
     26    const { createFactory } = browserRequire("devtools/client/shared/vendor/react");
     27    const Tree = createFactory(browserRequire("devtools/client/shared/components/VirtualizedTree"));
     28 
     29    function renderTree(props) {
     30      const treeProps = Object.assign({},
     31        TEST_TREE_INTERFACE,
     32        { autoExpandDepth: 1 },
     33        props
     34      );
     35      return ReactDOM.render(Tree(treeProps), window.document.body);
     36    }
     37 
     38    renderTree({ focused: "A" });
     39 
     40    isRenderedTree(document.body.textContent, [
     41      "A:true",
     42      "-B:false",
     43      "-C:false",
     44      "-D:false",
     45      "M:false",
     46      "-N:false",
     47    ], "Should have auto-expanded one level.");
     48  } catch(e) {
     49    ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
     50  } finally {
     51    SimpleTest.finish();
     52  }
     53 };
     54 </script>
     55 </pre>
     56 </body>
     57 </html>