tor-browser

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

browser_animation_animation-detail_visibility.js (1700B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test that whether animations detail could be displayed if there is selected animation.
      7 
      8 add_task(async function () {
      9  await addTab(URL_ROOT + "doc_custom_playback_rate.html");
     10  const { animationInspector, inspector, panel } =
     11    await openAnimationInspector();
     12 
     13  info("Checking animation detail visibility if animation was unselected");
     14  const detailEl = panel.querySelector("#animation-container .controlled");
     15  ok(detailEl, "The detail pane should be in the DOM");
     16  await assertDisplayStyle(detailEl, true, "detailEl should be unvisibled");
     17 
     18  info(
     19    "Checking animation detail visibility if animation was selected by click"
     20  );
     21  await clickOnAnimation(animationInspector, panel, 0);
     22  await assertDisplayStyle(detailEl, false, "detailEl should be visibled");
     23 
     24  info(
     25    "Checking animation detail visibility when choose node which has animations"
     26  );
     27  await selectNode("html", inspector);
     28  await assertDisplayStyle(
     29    detailEl,
     30    true,
     31    "detailEl should be unvisibled after choose html node"
     32  );
     33 
     34  info(
     35    "Checking animation detail visibility when choose node which has an animation"
     36  );
     37  await selectNode("div", inspector);
     38  await assertDisplayStyle(
     39    detailEl,
     40    false,
     41    "detailEl should be visibled after choose .cssanimation-normal node"
     42  );
     43 });
     44 
     45 async function assertDisplayStyle(detailEl, isNoneExpected, description) {
     46  const win = detailEl.ownerGlobal;
     47  await waitUntil(() => {
     48    const isNone = win.getComputedStyle(detailEl).display === "none";
     49    return isNone === isNoneExpected;
     50  });
     51  ok(true, description);
     52 }