Bug 1406285 - Part 2: Add test for animation target node. r?gl
MozReview-Commit-ID: toLYDFugJs
--- 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.
});