Bug 1474247 - Add a test case that the target element changed to another element in the same document. r?birtles
MozReview-Commit-ID: Dgew42GWT5d
--- 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>