tor-browser

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

browser_view_transition.js (1660B)


      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 /* import-globals-from ../../mochitest/role.js */
      8 loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
      9 
     10 /**
     11 * Verify that the view transition shouldn't get an accessible.
     12 */
     13 addAccessibleTask(
     14  `
     15 <style>
     16  ::view-transition-group(*),
     17  ::view-transition-image-pair(*),
     18  ::view-transition-old(*),
     19  ::view-transition-new(*) {
     20    animation-play-state: paused;
     21  }
     22  ::view-transition {
     23    background-color: blue;
     24  }
     25 </style>
     26 <div style="view-transition-name: target">target</div>
     27  `,
     28  async function (browser, docAcc) {
     29    const originalTree = { DOCUMENT: [{ SECTION: [{ TEXT_LEAF: [] }] }] };
     30 
     31    // Initial check.
     32    testAccessibleTree(docAcc, originalTree);
     33 
     34    info("Starting view transition");
     35    await invokeContentTask(browser, [], async () => {
     36      let vt = content.document.startViewTransition();
     37      await vt.ready;
     38    });
     39 
     40    info("Checking the existence of the view transition");
     41    await invokeContentTask(browser, [], async () => {
     42      is(
     43        content.getComputedStyle(
     44          content.document.documentElement,
     45          "::view-transition"
     46        ).backgroundColor,
     47        "rgb(0, 0, 255)",
     48        "The active view transition is animating"
     49      );
     50    });
     51 
     52    // The accessibility tree should not be changed with an active view
     53    // transition.
     54    testAccessibleTree(docAcc, originalTree);
     55  },
     56  {
     57    topLevel: true,
     58    iframe: true,
     59    remoteIframe: true,
     60    chrome: true,
     61  }
     62 );