Bug 1453568 - Add test case that animationcancel or transitioncancel event is not dispatched when setting null timeline in idle state. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 17 Apr 2018 08:29:05 +0900
changeset 783347 822a9c0f680e07227609b9d6824afb1d2547e1ce
parent 783346 8f03db3db2ed66e570a5450b914787a921ec3330
child 783348 037b431a9285f676cf2c65d4839e122f1bd184aa
push id106674
push userhikezoe@mozilla.com
push dateTue, 17 Apr 2018 01:36:18 +0000
reviewersbirtles
bugs1453568
milestone61.0a1
Bug 1453568 - Add test case that animationcancel or transitioncancel event is not dispatched when setting null timeline in idle state. r?birtles MozReview-Commit-ID: 3gXh5WcmWlY
dom/animation/test/css-animations/test_event-dispatch.html
dom/animation/test/css-transitions/test_event-dispatch.html
--- a/dom/animation/test/css-animations/test_event-dispatch.html
+++ b/dom/animation/test/css-animations/test_event-dispatch.html
@@ -131,16 +131,35 @@ promise_test(async t => {
   // Make idle
   animation.timeline = null;
   const event = await watcher.wait_for('animationcancel');
 
   assert_time_equals_literal(event.elapsedTime, 0.1);
 }, 'Active -> Idle, setting Animation.timeline = null');
 
 promise_test(async t => {
+  const { animation, watcher, div, handler } = setupAnimation(t, 'anim 100s');
+
+  await watcher.wait_for('animationstart');
+  animation.currentTime = 100.0;
+  // Make idle
+  animation.timeline = null;
+  const event = await watcher.wait_for('animationcancel');
+
+  assert_time_equals_literal(event.elapsedTime, 0.1);
+
+  handler.clear();
+
+  animation.timeline = null;
+  await waitForAnimationFrames(2);
+
+  assert_no_animation_event_received(handler);
+}, 'Idle -> Idle, setting Animation.timeline = null again');
+
+promise_test(async t => {
   // we should NOT pause animation since calling cancel synchronously.
   const { animation, watcher, div } = setupAnimation(t, 'anim 100s');
 
   await watcher.wait_for('animationstart');
   animation.currentTime = 50.0;
   animation.cancel();
   const event = await watcher.wait_for('animationcancel');
   assert_time_equals_literal(event.elapsedTime, 0.05);
--- a/dom/animation/test/css-transitions/test_event-dispatch.html
+++ b/dom/animation/test/css-transitions/test_event-dispatch.html
@@ -131,16 +131,35 @@ promise_test(async t => {
   await Promise.all([ watcher.wait_for('transitionrun'), transition.ready ]);
   // Make idle
   transition.timeline = null;
   const event = await watcher.wait_for('transitioncancel');
   assert_equals(event.elapsedTime, 0.0);
 }, 'Before -> Idle (Animation.timeline = null)');
 
 promise_test(async t => {
+  const { transition, watcher, handler } =
+    setupTransition(t, 'margin-left 100s 100s');
+
+  await Promise.all([ watcher.wait_for('transitionrun'), transition.ready ]);
+  // Make idle
+  transition.timeline = null;
+
+  const event = await watcher.wait_for('transitioncancel');
+  assert_equals(event.elapsedTime, 0.0);
+
+  handler.clear();
+
+  transition.timeline = null;
+  await waitForAnimationFrames(2);
+
+  assert_no_transition_event_received(handler);
+}, 'Idle -> Idle (Animation.timeline = null again)');
+
+promise_test(async t => {
   const { transition, watcher } =
     setupTransition(t, 'margin-left 100s 100s');
 
   await Promise.all([ watcher.wait_for('transitionrun'), transition.ready ]);
   transition.currentTime = 100 * MS_PER_SEC;
   const event = await watcher.wait_for('transitionstart');
   assert_equals(event.elapsedTime, 0.0);
 }, 'Before -> Active');