Bug 1464396 - Part 3: Add whether the created time of animation unchanged even if change node. r?pbro draft
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Tue, 29 May 2018 10:09:44 +0900
changeset 800739 16eb835a420cc7f4bf8d511570378aa918978696
parent 800738 f9d9423476d05fc8990807db5d6d76621bfd2218
child 800811 c23de49cf876eb3f6b5fb701f951fefeab9ed8b3
push id111458
push userbmo:dakatsuka@mozilla.com
push dateTue, 29 May 2018 01:25:51 +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: BT4DUJUFkdp
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>