summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/animation/test/browser_animation_animation-detail_title.js
blob: 91dfd2e50f9429f8555087d63c5752b01dbac29f (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
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Test that whether title in header of animations detail.

const TEST_DATA = [
  {
    targetClass: "cssanimation-normal",
    expectedTitle: "cssanimation — CSS Animation",
  },
  {
    targetClass: "delay-positive",
    expectedTitle: "test-delay-animation — Script Animation",
  },
  {
    targetClass: "easing-step",
    expectedTitle: "Script Animation",
  },
];

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

  info("Checking title in each header of animation detail");

  for (const { targetClass, expectedTitle } of TEST_DATA) {
    info(`Checking title at ${targetClass}`);
    await clickOnAnimationByTargetSelector(
      animationInspector,
      panel,
      `.${targetClass}`
    );
    const titleEl = panel.querySelector(".animation-detail-title");
    is(
      titleEl.textContent,
      expectedTitle,
      `Title of "${targetClass}" should be "${expectedTitle}"`
    );
  }
});