summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/animation/test/browser_animation_empty_on_invalid_nodes.js
blob: d3fa9166a1f5938ff9c5d6a2b895213892ddf96c (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
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";

// Test that the panel shows no animation data for invalid or not animated nodes

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

  info("Checking animation list and error message existence for a still node");
  const stillNode = await getNodeFront(".still", inspector);
  await selectNode(stillNode, inspector);

  await waitUntil(() => panel.querySelector(".animation-error-message"));
  ok(
    true,
    "Element which has animation-error-message class should exist for a still node"
  );
  is(
    panel.querySelector(".animation-error-message > p").textContent,
    ANIMATION_L10N.getStr("panel.noAnimation"),
    "The correct error message is displayed"
  );
  ok(
    !panel.querySelector(".animation-list"),
    "Element which has animations class should not exist for a still node"
  );

  info(
    "Show animations once to confirm if there is no animations on the comment node"
  );
  await selectNode(".long", inspector);
  await waitUntil(() => !panel.querySelector(".animation-error-message"));

  info("Checking animation list and error message existence for a text node");
  const commentNode = await inspector.walker.previousSibling(stillNode);
  await selectNode(commentNode, inspector);
  await waitUntil(() => panel.querySelector(".animation-error-message"));
  ok(
    panel.querySelector(".animation-error-message"),
    "Element which has animation-error-message class should exist for a text node"
  );
  ok(
    !panel.querySelector(".animation-list"),
    "Element which has animations class should not exist for a text node"
  );
});