tor-browser

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

browser_flexbox_container_properties.js (1688B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test that the flex container properties are shown when a flex container is selected.
      7 
      8 const TEST_URI = `
      9  <style type='text/css'>
     10    #container1 {
     11      display: flex;
     12    }
     13  </style>
     14  <div id="container1">
     15    <div id="item"></div>
     16  </div>
     17 `;
     18 
     19 add_task(async function () {
     20  await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
     21  const { inspector, flexboxInspector } = await openLayoutView();
     22  const { document: doc } = flexboxInspector;
     23 
     24  info(
     25    "Selecting the flex container #container1 and checking the values of the flex " +
     26      "container properties for #container1."
     27  );
     28  const onFlexContainerPropertiesRendered = waitForDOM(
     29    doc,
     30    ".flex-header-container-properties"
     31  );
     32  await selectNode("#container1", inspector);
     33  const [flexContainerProperties] = await onFlexContainerPropertiesRendered;
     34 
     35  ok(flexContainerProperties, "The flex container properties is rendered.");
     36  is(
     37    flexContainerProperties.children[0].textContent,
     38    "row",
     39    "Got expected flex-direction."
     40  );
     41  is(
     42    flexContainerProperties.children[1].textContent,
     43    "nowrap",
     44    "Got expected flex-wrap."
     45  );
     46 
     47  info(
     48    "Selecting a flex item and expecting the flex container properties to not be " +
     49      "shown."
     50  );
     51  const onFlexHeaderRendered = waitForDOM(doc, ".flex-header");
     52  await selectNode("#item", inspector);
     53  const [flexHeader] = await onFlexHeaderRendered;
     54 
     55  ok(
     56    !flexHeader.querySelector(".flex-header-container-properties"),
     57    "The flex container properties is not shown in the header."
     58  );
     59 });