Bug 1474247 - Add a test case that the target element changed to another element in the same document. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Thu, 12 Jul 2018 17:05:49 +0900
changeset 817227 eab044f9156aaa35cd4fafb2652671cea8a4c222
parent 817226 271e2a75da1fc01b5fa5ebce0a4e7a33c4f18b43
child 817228 ed8c7f697f3585ddf79e2f224c04239092009ce1
push id115993
push userhikezoe@mozilla.com
push dateThu, 12 Jul 2018 08:06:50 +0000
reviewersbirtles
bugs1474247
milestone63.0a1
Bug 1474247 - Add a test case that the target element changed to another element in the same document. r?birtles MozReview-Commit-ID: Dgew42GWT5d
dom/animation/test/mozilla/test_pending_animation_tracker.html
--- a/dom/animation/test/mozilla/test_pending_animation_tracker.html
+++ b/dom/animation/test/mozilla/test_pending_animation_tracker.html
@@ -85,10 +85,23 @@ promise_test(async t => {
 
   await waitForNextFrame();
   assert_false(SpecialPowers.DOMWindowUtils.isAnimationInPendingTracker(anim),
                'The animation should NOT be tracked by the tracker in the ' +
                'next frame');
 }, 'Removing target element from the document removes the animation from ' +
    'the tracker in the next tick');
 
+test(t => {
+  const target = addDiv(t);
+  const anotherTarget = addDiv(t);
+  const anim = target.animate(null, 100 * MS_PER_SEC);
+  assert_true(SpecialPowers.DOMWindowUtils.isAnimationInPendingTracker(anim),
+              'The animation should be tracked by tracker');
+
+  anim.effect.target = anotherTarget;
+
+  assert_true(SpecialPowers.DOMWindowUtils.isAnimationInPendingTracker(anim),
+              'The animation should be still tracked by tracker');
+}, 'Setting another target keeps the pending animation in the tracker');
+
 </script>
 </body>