summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/animation/test/browser_animation_animated-property-list.js
blob: 47661d00fceee0e37d0965b42d1b237894489ee5 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Test following animated property list test.
// 1. Existence for animated property list.
// 2. Number of animated property item.

const TEST_DATA = [
  {
    targetClass: "animated",
    expectedNumber: 1,
  },
  {
    targetClass: "compositor-notall",
    expectedNumber: 4,
  },
];

add_task(async function () {
  await addTab(URL_ROOT + "doc_simple_animation.html");
  await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${t.targetClass}`));
  const { animationInspector, panel } = await openAnimationInspector();

  info("Checking animated property list and items existence at initial");
  ok(
    !panel.querySelector(".animated-property-list"),
    "The animated-property-list should not be in the DOM at initial"
  );

  for (const { targetClass, expectedNumber } of TEST_DATA) {
    info(
      `Checking animated-property-list and items existence at ${targetClass}`
    );
    await clickOnAnimationByTargetSelector(
      animationInspector,
      panel,
      `.${targetClass}`
    );

    await waitUntil(
      () =>
        panel.querySelectorAll(".animated-property-item").length ===
        expectedNumber
    );
    ok(
      true,
      `The number of animated-property-list should be ${expectedNumber} at ${targetClass}`
    );
  }
});