tor-browser

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

browser_compatibility_event_selected-node-change.js (2159B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test whether the content of the issue list will be changed when the new node is selected.
      7 
      8 const TEST_URI = `
      9  <style>
     10  body {
     11    overflow-anchor: auto;
     12  }
     13 
     14  .has-issue {
     15    user-select: auto;
     16    user-modify: read-only;
     17  }
     18 
     19  .no-issue {
     20    color: black;
     21  }
     22  </style>
     23  <body>
     24    <div class="has-issue">has issue</div>
     25    <div class="no-issue">no issue</div>
     26  </body>
     27 `;
     28 
     29 const TEST_DATA_SELECTED = [
     30  {
     31    selector: ".has-issue",
     32    expectedIssues: [
     33      {
     34        property: "user-select",
     35        url: "https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/user-select",
     36      },
     37      {
     38        property: "user-modify",
     39        url: "https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/user-modify",
     40      },
     41    ],
     42  },
     43  {
     44    selector: ".no-issue",
     45    expectedIssues: [],
     46  },
     47  {
     48    selector: "body",
     49    expectedIssues: [
     50      {
     51        property: "overflow-anchor",
     52        url: "https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overflow-anchor",
     53      },
     54    ],
     55  },
     56 ];
     57 
     58 const TEST_DATA_ALL = [
     59  {
     60    property: "overflow-anchor",
     61    url: "https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overflow-anchor",
     62  },
     63  {
     64    property: "user-select",
     65    url: "https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/user-select",
     66  },
     67  {
     68    property: "user-modify",
     69    url: "https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/user-modify",
     70  },
     71 ];
     72 
     73 add_task(async function () {
     74  await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
     75 
     76  const { allElementsPane, inspector, selectedElementPane } =
     77    await openCompatibilityView();
     78 
     79  for (const { selector, expectedIssues } of TEST_DATA_SELECTED) {
     80    info(`Check the issue list for ${selector} node`);
     81    await selectNode(selector, inspector);
     82    await assertIssueList(selectedElementPane, expectedIssues);
     83    info("Check whether the issues on all elements pane are not changed");
     84    await assertIssueList(allElementsPane, TEST_DATA_ALL);
     85  }
     86 });