tor-browser

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

browser_animation_getPlayers.js (1630B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Check the output of getAnimationPlayersForNode
      7 
      8 add_task(async function () {
      9  const { target, walker, animations } = await initAnimationsFrontForUrl(
     10    MAIN_DOMAIN + "animation.html"
     11  );
     12 
     13  await theRightNumberOfPlayersIsReturned(walker, animations);
     14 
     15  await target.destroy();
     16  gBrowser.removeCurrentTab();
     17 });
     18 
     19 async function theRightNumberOfPlayersIsReturned(walker, animations) {
     20  let node = await walker.querySelector(walker.rootNode, ".not-animated");
     21  let players = await animations.getAnimationPlayersForNode(node);
     22  is(players.length, 0, "0 players were returned for the unanimated node");
     23 
     24  node = await walker.querySelector(walker.rootNode, ".simple-animation");
     25  players = await animations.getAnimationPlayersForNode(node);
     26  is(players.length, 1, "One animation player was returned");
     27 
     28  node = await walker.querySelector(walker.rootNode, ".multiple-animations");
     29  players = await animations.getAnimationPlayersForNode(node);
     30  is(players.length, 2, "Two animation players were returned");
     31 
     32  node = await walker.querySelector(walker.rootNode, ".transition");
     33  players = await animations.getAnimationPlayersForNode(node);
     34  is(
     35    players.length,
     36    1,
     37    "One animation player was returned for the transitioned node"
     38  );
     39 
     40  // Asserting fix for Bug 2001562
     41  node = await walker.querySelector(walker.rootNode, ".button-animation");
     42  players = await animations.getAnimationPlayersForNode(node);
     43  is(players.length, 1, "Got an animation player for the animated button");
     44 }