summaryrefslogtreecommitdiffstats
path: root/devtools/client/animationinspector/test/browser_animation_refresh_on_removed_animation.js
blob: 011d4a08629a6915714f3c19dc7e33fed21e6ef5 (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
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
 http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

requestLongerTimeout(2);

// Test that the panel content refreshes when animations are removed.

add_task(function* () {
  yield addTab(URL_ROOT + "doc_simple_animation.html");

  let {inspector, panel} = yield openAnimationInspector();
  yield testRefreshOnRemove(inspector, panel);
});

function* testRefreshOnRemove(inspector, panel) {
  info("Select a animated node");
  yield selectNodeAndWaitForAnimations(".animated", inspector);

  assertAnimationsDisplayed(panel, 1);

  info("Listen to the next UI update event");
  let onPanelUpdated = panel.once(panel.UI_UPDATED_EVENT);

  info("Remove the animation on the node by removing the class");
  yield executeInContent("devtools:test:setAttribute", {
    selector: ".animated",
    attributeName: "class",
    attributeValue: "ball still test-node"
  });

  yield onPanelUpdated;
  ok(true, "The panel update event was fired");

  assertAnimationsDisplayed(panel, 0);

  info("Add an finite animation on the node again, and wait for it to appear");
  onPanelUpdated = panel.once(panel.UI_UPDATED_EVENT);
  yield executeInContent("devtools:test:setAttribute", {
    selector: ".test-node",
    attributeName: "class",
    attributeValue: "ball short test-node"
  });
  yield onPanelUpdated;
  yield waitForAllAnimationTargets(panel);

  assertAnimationsDisplayed(panel, 1);
}