tor-browser

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

browser_accessibility_tree_contrast.js (1488B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const TEST_URI = `<html>
      7  <head>
      8    <meta charset="utf-8"/>
      9    <title>Accessibility Panel Test</title>
     10  </head>
     11  <body>
     12    <h1 style="color:rgba(255,0,0,0.1); background-color:rgba(255,255,255,1);">
     13      Top level header
     14    </h1>
     15  </body>
     16 </html>`;
     17 
     18 /**
     19 * Test data has the format of:
     20 * {
     21 *   desc     {String}    description for better logging
     22 *   setup    {Function}  An optional setup that needs to be performed before
     23 *                        the state of the tree and the sidebar can be checked.
     24 *   expected {JSON}      An expected states for the tree and the sidebar.
     25 * }
     26 */
     27 const tests = [
     28  {
     29    desc: "Expand first and second tree nodes.",
     30    setup: async ({ doc }) => {
     31      await toggleRow(doc, 0);
     32      await toggleRow(doc, 1);
     33    },
     34    expected: {
     35      tree: [
     36        {
     37          role: "document",
     38          name: `"Accessibility Panel Test"`,
     39        },
     40        {
     41          role: "heading",
     42          name: `"Top level header"`,
     43        },
     44        {
     45          role: "text leaf",
     46          name: `"Top level header "contrast`,
     47          badges: ["contrast"],
     48        },
     49      ],
     50    },
     51  },
     52 ];
     53 
     54 /**
     55 * Simple test that checks content of the Accessibility panel tree when one of
     56 * the tree rows has a "contrast" badge.
     57 */
     58 addA11yPanelTestsTask(
     59  tests,
     60  TEST_URI,
     61  "Test Accessibility panel tree with contrast badge."
     62 );