summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/animation/test/browser_animation_animation-list.js
blob: 4f2c4419b35694c96b5896de7b382dee35ca5f60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Test that whether animations ui could be displayed

add_task(async function () {
  await addTab(URL_ROOT + "doc_simple_animation.html");
  await removeAnimatedElementsExcept([".animated", ".long"]);
  const { animationInspector, inspector, panel } =
    await openAnimationInspector();

  info("Checking animation list and items existence");
  ok(
    panel.querySelector(".animation-list"),
    "The animation-list is in the DOM"
  );
  is(
    panel.querySelectorAll(".animation-list .animation-item").length,
    animationInspector.state.animations.length,
    "The number of animations displayed matches the number of animations"
  );

  info(
    "Checking list and items existence after select a element which has an animation"
  );
  await selectNode(".animated", inspector);
  await waitUntil(
    () => panel.querySelectorAll(".animation-list .animation-item").length === 1
  );
  ok(
    true,
    "The number of animations displayed should be 1 for .animated element"
  );
});