summaryrefslogtreecommitdiffstats
path: root/devtools/client/animationinspector/test/browser_animation_mutations_with_same_names.js
blob: 1ae19c277da215cef2864bdcd5faf8919794cfb0 (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
/* 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";

// Check that when animations are added later (through animation mutations) and
// if these animations have the same names, then all of them are still being
// displayed (which should be true as long as these animations apply to
// different nodes).

add_task(function* () {
  yield addTab(URL_ROOT + "doc_negative_animation.html");
  let {controller, panel} = yield openAnimationInspector();

  info("Wait until all animations have been added " +
       "(they're added with setTimeout)");
  while (controller.animationPlayers.length < 3) {
    yield controller.once(controller.PLAYERS_UPDATED_EVENT);
  }
  yield waitForAllAnimationTargets(panel);

  is(panel.animationsTimelineComponent.animations.length, 3,
     "The timeline shows 3 animations too");

  // Reduce the known nodeFronts to a set to make them unique.
  let nodeFronts = new Set(panel.animationsTimelineComponent
                                .targetNodes.map(n => n.previewer.nodeFront));
  is(nodeFronts.size, 3,
     "The animations are applied to 3 different node fronts");
});