Bug 1264125 part 6 - Add transitioncancel tests. r?birtles draft
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Thu, 20 Oct 2016 14:19:24 +0900
changeset 427860 cd8410d4a9311b89a2a0937a173611978acd4fc5
parent 427859 ce3a69425dce8f6295dc65cde11b7b0cdda2fbba
child 534575 fa7087c16bd3d18c3fcec3c1b5e029b1dd7cf80a
push id33142
push usermantaroh@gmail.com
push dateFri, 21 Oct 2016 00:27:27 +0000
reviewersbirtles
bugs1264125
milestone52.0a1
Bug 1264125 part 6 - Add transitioncancel tests. r?birtles MozReview-Commit-ID: HPd8R4lbtAC
dom/animation/test/css-transitions/file_csstransition-events.html
--- a/dom/animation/test/css-transitions/file_csstransition-events.html
+++ b/dom/animation/test/css-transitions/file_csstransition-events.html
@@ -32,17 +32,18 @@ TransitionEventHandler.prototype.clear =
   this.transitionend   = undefined;
 };
 
 function setupTransition(t) {
   var div, watcher, handler, transition;
   div = addDiv(t, { style: 'transition: margin-left 100s 100s' });
   watcher = new EventWatcher(t, div, [ 'transitionrun',
                                        'transitionstart',
-                                       'transitionend' ]);
+                                       'transitionend',
+                                       'transitioncancel' ]);
   handler = new TransitionEventHandler(div);
   flushComputedStyle(div);
 
   div.style.marginLeft = '100px';
   flushComputedStyle(div);
 
   transition = div.getAnimations()[0];
 
@@ -89,16 +90,33 @@ promise_test(function(t) {
     assert_equals(handler.transitionrun, 0.0);
     assert_equals(handler.transitionstart, 0.0);
     assert_equals(handler.transitionend, 100.0);
   });
 }, 'Idle or Pending -> After');
 
 promise_test(function(t) {
   var [transition, watcher, handler] = setupTransition(t);
+dump("DEBUG1\n");
+  transition.currentTime = 100 * MS_PER_SEC;
+  return Promise.all([ watcher.wait_for([ 'transitionrun', 'transitionstart' ]),
+                       transition.ready ]).then(function() {
+dump("DEBUG2\n");
+    handler.target.style.display = 'none';
+    flushComputedStyle(handler.target);
+
+    return watcher.wait_for('transitioncancel');
+  }).then(function(evt) {
+dump("DEBUG3\n");
+    assert_equals(evt.elapsedTime, 0.0);
+  });
+}, 'Before -> Idle');
+
+promise_test(function(t) {
+  var [transition, watcher, handler] = setupTransition(t);
 
   return Promise.all([ watcher.wait_for('transitionrun'),
                        transition.ready ]).then(function() {
     transition.currentTime = 100 * MS_PER_SEC;
     return watcher.wait_for('transitionstart');
   }).then(function() {
     assert_equals(handler.transitionstart, 0.0);
   });
@@ -118,16 +136,31 @@ promise_test(function(t) {
 }, 'Before -> After');
 
 promise_test(function(t) {
   var [transition, watcher, handler] = setupTransition(t);
   // Seek to Active phase.
   transition.currentTime = 100 * MS_PER_SEC;
   return watcher.wait_for([ 'transitionrun',
                             'transitionstart' ]).then(function(evt) {
+    // Seek to Idle
+    handler.target.style.display = 'none';
+    flushComputedStyle(handler.target);
+    return watcher.wait_for('transitioncancel');
+  }).then(function(evt) {
+    assert_equals(evt.elapsedTime, 0.0);
+  });
+}, 'Active -> Idle');
+
+promise_test(function(t) {
+  var [transition, watcher, handler] = setupTransition(t);
+  // Seek to Active phase.
+  transition.currentTime = 100 * MS_PER_SEC;
+  return watcher.wait_for([ 'transitionrun',
+                            'transitionstart' ]).then(function(evt) {
     // Seek to Before phase.
     transition.currentTime = 0;
     return watcher.wait_for('transitionend');
   }).then(function(evt) {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Active -> Before');