tor-browser

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

browser_accessibility_panel_audit_hidden_iframe.js (1692B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 /* global toggleMenuItem, TREE_FILTERS_MENU_ID */
      7 
      8 const TEST_URI = `<html>
      9   <head>
     10     <meta charset="utf-8"/>
     11     <title>Accessibility Panel Test</title>
     12   </head>
     13   <body>
     14     <h1 style="color:rgba(255,0,0,0.1); background-color:rgba(255,255,255,1);">
     15       Top level header
     16     </h1>
     17     <iframe style="display: none"></iframe>
     18     <iframe style="display: none" src="data:text/html,iframe"></iframe>
     19     <iframe style="display: none" src="https://example.com/document-builder.sjs?html=oop"></iframe>
     20   </body>
     21 </html>`;
     22 
     23 /**
     24 * Test data has the format of:
     25 * {
     26 *   desc     {String}    description for better logging
     27 *   setup    {Function}  An optional setup that needs to be performed before
     28 *                        the state of the tree and the sidebar can be checked.
     29 *   expected {JSON}      An expected states for the tree and the sidebar.
     30 * }
     31 */
     32 const tests = [
     33  {
     34    desc: "Initial state.",
     35    expected: {
     36      tree: [
     37        {
     38          role: "document",
     39          name: `"Accessibility Panel Test"`,
     40        },
     41      ],
     42    },
     43  },
     44  {
     45    desc: "Click on the Check for issues - all.",
     46    setup: async ({ doc, toolbox }) => {
     47      await toggleMenuItem(doc, toolbox.doc, TREE_FILTERS_MENU_ID, 1);
     48    },
     49    expected: {
     50      tree: [
     51        {
     52          role: "text leaf",
     53          name: `"Top level header "contrast`,
     54          badges: ["contrast"],
     55          level: 1,
     56        },
     57      ],
     58    },
     59  },
     60 ];
     61 
     62 addA11yPanelTestsTask(
     63  tests,
     64  TEST_URI,
     65  "Test Accessibility panel tree audit on a page with hidden iframes."
     66 );