Bug 1406285 - Part 2: Add test for animation target node. r?gl draft
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Thu, 18 Jan 2018 10:40:51 +0900
changeset 721931 7b9453a9313039320e8985a6dda2f5b9c244ef13
parent 721930 a01701ebf148a1d9f87ab7b5a6628f91d98ea651
child 721932 61f56507a676eb5543c3a87172cc1f0378c3dc65
push id96003
push userbmo:dakatsuka@mozilla.com
push dateThu, 18 Jan 2018 05:23:36 +0000
reviewersgl
bugs1406285
milestone59.0a1
Bug 1406285 - Part 2: Add test for animation target node. r?gl MozReview-Commit-ID: toLYDFugJs
devtools/client/inspector/animation/test/browser.ini
devtools/client/inspector/animation/test/browser_animation_AnimationTarget.js
devtools/client/inspector/animation/test/browser_animation_animation_list_exists.js
--- a/devtools/client/inspector/animation/test/browser.ini
+++ b/devtools/client/inspector/animation/test/browser.ini
@@ -7,10 +7,11 @@ support-files =
   !/devtools/client/framework/test/shared-head.js
   !/devtools/client/inspector/test/head.js
   !/devtools/client/inspector/test/shared-head.js
   !/devtools/client/shared/test/test-actor-registry.js
   !/devtools/client/shared/test/test-actor.js
 
 [browser_animation_animation_list_exists.js]
 [browser_animation_animation_list_time_tick.js]
+[browser_animation_AnimationTarget.js]
 [browser_animation_empty_on_invalid_nodes.js]
 [browser_animation_inspector_exists.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/inspector/animation/test/browser_animation_AnimationTarget.js
@@ -0,0 +1,32 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Test existance and content of animation target.
+
+add_task(async function () {
+  await addTab(URL_ROOT + "doc_simple_animation.html");
+  const { animationInspector, inspector, panel } = await openAnimationInspector();
+
+  info("Checking the animation target elements existance");
+  const animationItemEls = panel.querySelectorAll(".animation-list .animation-item");
+  is(animationItemEls.length, animationInspector.animations.length,
+     "Number of animation target element should be same to number of animations "
+     + "that displays");
+
+  for (const animationItemEl of animationItemEls) {
+    const animationTargetEl = animationItemEl.querySelector(".animation-target");
+    ok(animationTargetEl,
+       "The animation target element should be in each animation item element");
+  }
+
+  info("Checking the content of animation target");
+  await selectNodeAndWaitForAnimations(".animated", inspector);
+  const animationTargetEl =
+    panel.querySelector(".animation-list .animation-item .animation-target");
+  is(animationTargetEl.textContent, "div.ball.animated",
+     "The target element's content is correct");
+  ok(animationTargetEl.querySelector(".objectBox"),
+     "objectBox is in the page exists");
+});
--- a/devtools/client/inspector/animation/test/browser_animation_animation_list_exists.js
+++ b/devtools/client/inspector/animation/test/browser_animation_animation_list_exists.js
@@ -30,11 +30,10 @@ add_task(async function () {
   const animatedNode = await getNodeFront(".animated", inspector);
   await selectNodeAndWaitForAnimations(animatedNode, inspector);
   is(panel.querySelectorAll(".animation-list .animation-item").length, 1,
      "The number of animations displayed should be 1 for .animated element");
 
   // TODO: We need to add following tests after implement since this test has same role
   // of animationinspector/test/browser_animation_timeline_ui.js
   // * name label in animation element existance.
-  // * target node in animation element existance.
   // * summary graph in animation element existance.
 });