tor-browser

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

browser_flexbox_sizing_info_exists.js (1355B)


      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 item sizing information exists when a flex item is selected.
      7 
      8 const TEST_URI = URL_ROOT + "doc_flexbox_specific_cases.html";
      9 
     10 add_task(async function () {
     11  await addTab(TEST_URI);
     12  const { inspector, flexboxInspector } = await openLayoutView();
     13  const { document: doc } = flexboxInspector;
     14 
     15  // Select a flex item in the test document and wait for the sizing info to be rendered.
     16  // Note that we select an item that has base, delta and final sizes, so we can check
     17  // those sections exists.
     18  const onFlexItemSizingRendered = waitForDOM(doc, "ul.flex-item-sizing");
     19  await selectNode(".container.growing .item", inspector);
     20  const [flexSizingContainer] = await onFlexItemSizingRendered;
     21 
     22  ok(flexSizingContainer, "The flex sizing exists in the DOM");
     23 
     24  info("Check that the base, flexibility and final sizes are displayed");
     25  const allSections = [
     26    ...flexSizingContainer.querySelectorAll(".section .name"),
     27  ];
     28  const allSectionTitles = allSections.map(el => el.textContent);
     29 
     30  ["Base Size", "Flexibility", "Final Size"].forEach((expectedTitle, i) => {
     31    ok(
     32      allSectionTitles[i].includes(expectedTitle),
     33      `Sizing section #${i + 1} (${expectedTitle}) was found`
     34    );
     35  });
     36 });