tor-browser

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

browser_inspector-isScrollable.js (1251B)


      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 
      5 "use strict";
      6 
      7 const URL = MAIN_DOMAIN + "inspector-isScrollable-data.html";
      8 
      9 const CASES = [
     10  { id: "body", expected: false },
     11  { id: "no_children", expected: false },
     12  { id: "one_child_no_overflow", expected: false },
     13  { id: "margin_left_overflow", expected: true },
     14  { id: "transform_overflow", expected: true },
     15  { id: "nested_overflow", expected: true },
     16  { id: "intermediate_overflow", expected: true },
     17  { id: "multiple_overflow_at_different_depths", expected: true },
     18  { id: "overflow_hidden", expected: false },
     19  { id: "scrollbar_none", expected: false },
     20 ];
     21 
     22 add_task(async function () {
     23  info(
     24    "Test that elements with scrollbars have a true value for isScrollable, and elements without scrollbars have a false value."
     25  );
     26  const { walker } = await initInspectorFront(URL);
     27 
     28  for (const { id, expected } of CASES) {
     29    info(`Checking element id ${id}.`);
     30 
     31    const el = await walker.querySelector(walker.rootNode, `#${id}`);
     32    is(el.isScrollable, expected, `${id} has expected value for isScrollable.`);
     33  }
     34 });