Bug 1464396 - Part 3: Add whether the created time of animation unchanged even if change node. r?pbro draft
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Sat, 26 May 2018 00:37:21 +0900
changeset 799921 f32f90e8f03fe8cc76a55b80eb78877658b4419a
parent 799920 b772cedd59b59846034e6e6e0493c3b57df4bfc3
push id111203
push userbmo:dakatsuka@mozilla.com
push dateFri, 25 May 2018 15:44:00 +0000
reviewerspbro
bugs1464396
milestone62.0a1
Bug 1464396 - Part 3: Add whether the created time of animation unchanged even if change node. r?pbro MozReview-Commit-ID: BuIOs6j0Md
devtools/client/inspector/animation/test/browser.ini
devtools/client/inspector/animation/test/browser_animation_logic_created-time.js
devtools/client/inspector/animation/test/doc_custom_playback_rate.html
--- a/devtools/client/inspector/animation/test/browser.ini
+++ b/devtools/client/inspector/animation/test/browser.ini
@@ -38,16 +38,17 @@ support-files =
 [browser_animation_inspector_exists.js]
 [browser_animation_keyframes-graph_computed-value-path.js]
 [browser_animation_keyframes-graph_computed-value-path_easing-hint.js]
 [browser_animation_keyframes-graph_keyframe-marker.js]
 [browser_animation_keyframes-progress-bar.js]
 [browser_animation_keyframes-progress-bar_after-resuming.js]
 [browser_animation_logic_auto-stop.js]
 [browser_animation_logic_avoid-updating-during-hiding.js]
+[browser_animation_logic_created-time.js]
 [browser_animation_logic_mutations.js]
 [browser_animation_logic_mutations_fast.js]
 [browser_animation_pause-resume-button.js]
 [browser_animation_pause-resume-button_end-time.js]
 [browser_animation_pause-resume-button_respectively.js]
 [browser_animation_pause-resume-button_spacebar.js]
 [browser_animation_playback-rate-selector.js]
 [browser_animation_pseudo-element.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/inspector/animation/test/browser_animation_logic_created-time.js
@@ -0,0 +1,33 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Test whether the created time of animation unchanged even if change node.
+
+add_task(async function() {
+  await addTab(URL_ROOT + "doc_custom_playback_rate.html");
+  const { animationInspector, inspector } = await openAnimationInspector();
+
+  info("Check both the created time of animation are same");
+  const baseCreatedTime = animationInspector.state.animations[0].state.createdTime;
+  is(animationInspector.state.animations[1].state.createdTime, baseCreatedTime,
+    "Both created time of animations should be same");
+
+  info("Check created time after selecting '.div1'");
+  await selectNodeAndWaitForAnimations(".div1", inspector);
+  is(animationInspector.state.animations[0].state.createdTime, baseCreatedTime,
+    "The created time of animation on element of .div1 should unchanged");
+
+  info("Check created time after selecting '.div2'");
+  await selectNodeAndWaitForAnimations(".div2", inspector);
+  is(animationInspector.state.animations[0].state.createdTime, baseCreatedTime,
+     "The created time of animation on element of .div2 should unchanged");
+
+  info("Check created time after selecting 'body' again");
+  await selectNodeAndWaitForAnimations("body", inspector);
+  is(animationInspector.state.animations[0].state.createdTime, baseCreatedTime,
+    "The created time of animation[0] should unchanged");
+  is(animationInspector.state.animations[1].state.createdTime, baseCreatedTime,
+    "The created time of animation[1] should unchanged");
+});
--- a/devtools/client/inspector/animation/test/doc_custom_playback_rate.html
+++ b/devtools/client/inspector/animation/test/doc_custom_playback_rate.html
@@ -10,20 +10,21 @@
     </style>
   </head>
   <body>
     <script>
     "use strict";
 
     const duration = 100000;
 
-    function createAnimation() {
+    function createAnimation(cls) {
       const div = document.createElement("div");
+      div.classList.add(cls);
       document.body.appendChild(div);
       const animation = div.animate([{ opacity: 0 }], duration);
       animation.playbackRate = 1.5;
     }
 
-    createAnimation();
-    createAnimation();
+    createAnimation("div1");
+    createAnimation("div2");
     </script>
   </body>
 </html>