Bug 1354501 - Add test cases that animation event is fired for the animation on an orphaned element. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 03 Jul 2018 09:25:02 +0900
changeset 813413 278a5d291c93f83d6a4a819ef94777268de575eb
parent 813412 b7cba8315aa1a4b0ece6367daa6d6d1565611d4c
child 813414 3a5378897c29a7ab4bcb5b4cba94947ebd58771b
push id114891
push userhikezoe@mozilla.com
push dateTue, 03 Jul 2018 04:49:25 +0000
reviewersbirtles
bugs1354501
milestone63.0a1
Bug 1354501 - Add test cases that animation event is fired for the animation on an orphaned element. r?birtles MozReview-Commit-ID: 9PX2sVop484
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/web-animations/timing-model/animations/canceling-an-animation.html
testing/web-platform/tests/web-animations/timing-model/animations/finishing-an-animation.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -618697,21 +618697,21 @@
    "b8cc580e3e8d17961ffff4b693857f6c333dd57f",
    "testharness"
   ],
   "web-animations/timing-model/animation-effects/simple-iteration-progress.html": [
    "602fe7e6880e0b18329262699872c696f451d744",
    "testharness"
   ],
   "web-animations/timing-model/animations/canceling-an-animation.html": [
-   "c2750f33d773b01a9ed5ac4bb8c9f65f7e78265a",
+   "ea37c5d1dfdff51a085552c742e77730e2c697e7",
    "testharness"
   ],
   "web-animations/timing-model/animations/finishing-an-animation.html": [
-   "afe654435332e798b3771b6ec6ca13bcca99e421",
+   "2800a906d3fbc0f8622a2543ea9c1020d39cd95f",
    "testharness"
   ],
   "web-animations/timing-model/animations/pausing-an-animation.html": [
    "55acd5e4394d3c2543a00d90656a8134c497287b",
    "testharness"
   ],
   "web-animations/timing-model/animations/play-states.html": [
    "0ab2fa3a464001272d1af541ea769fa967490c3b",
--- a/testing/web-platform/tests/web-animations/timing-model/animations/canceling-an-animation.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/canceling-an-animation.html
@@ -101,10 +101,26 @@ promise_test(t => {
   });
 
   animation.cancel();
 
   return waitForAnimationFrames(3);
 }, 'The cancel event should NOT be fired if the animation is already'
    + ' idle');
 
+promise_test(async t => {
+  const div = createDiv(t);
+  const animation = div.animate({}, 100 * MS_PER_SEC);
+  div.remove();
+
+  const eventWatcher = new EventWatcher(t, animation, 'cancel');
+
+  await animation.ready;
+  animation.cancel();
+
+  await eventWatcher.wait_for('cancel');
+
+  assert_equals(animation.effect.target.parentNode, null,
+    'cancel event should be fired for the animation on an orphaned element');
+}, 'Canceling an animation should fire cancel event on orphaned element');
+
 </script>
 </body>
--- a/testing/web-platform/tests/web-animations/timing-model/animations/finishing-an-animation.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/finishing-an-animation.html
@@ -279,10 +279,25 @@ promise_test(async t => {
 
   animation.updatePlaybackRate(-1);
 
   animation.finish();
   // Should not have thrown
 }, 'An exception is NOT thrown when finishing if the effective playback rate'
    + ' is negative and the target effect end is infinity');
 
+promise_test(async t => {
+  const div = createDiv(t);
+  const animation = div.animate({}, 100 * MS_PER_SEC);
+  div.remove();
+
+  const eventWatcher = new EventWatcher(t, animation, 'finish');
+
+  await animation.ready;
+  animation.finish();
+
+  await eventWatcher.wait_for('finish');
+  assert_equals(animation.effect.target.parentNode, null,
+    'finish event should be fired for the animation on an orphaned element');
+}, 'Finishing an animation fires finish event on orphaned element');
+
 </script>
 </body>