tor-browser

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

anchor-name.mjs (1667B)


      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 // InactivePropertyHelper: `anchor-name` test cases.
      6 const tests = [
      7  ...createDisplayTests(
      8    [
      9      "block",
     10      "block ruby",
     11      "flex",
     12      "flow-root",
     13      "flow-root list-item",
     14      "grid",
     15      "inherit",
     16      "inline flow-root list-item",
     17      "inline-block",
     18      "inline-flex",
     19      "inline-grid",
     20      "list-item",
     21      "table-caption",
     22      "initial",
     23      "inline",
     24      "inline list-item",
     25      "inline-table",
     26      "ruby",
     27      "ruby-base",
     28      "ruby-base-container",
     29      "ruby-text",
     30      "ruby-text-container",
     31      "table",
     32      "table-cell",
     33      "table-column",
     34      "table-column-group",
     35      "table-footer-group",
     36      "table-header-group",
     37      "table-row",
     38      "table-row-group",
     39      "unset",
     40    ],
     41    true
     42  ),
     43  ...createDisplayTests(["none", "contents"], false),
     44  {
     45    info: "anchor-name is active on replaced element",
     46    property: "anchor-name",
     47    tagName: "img",
     48    rules: ["img { anchor-name: --anchor; display: block; }"],
     49    isActive: true,
     50  },
     51 ];
     52 
     53 function createDisplayTests(displayValues, active) {
     54  return displayValues.map(displayValue => {
     55    return {
     56      info: `anchor-name is ${
     57        active ? "active" : "inactive"
     58      } on an element with display: ${displayValue}`,
     59      property: "anchor-name",
     60      tagName: "div",
     61      rules: [`div { display: ${displayValue}; anchor-name: --anchor; }`],
     62      isActive: active,
     63    };
     64  });
     65 }
     66 
     67 export default tests;