diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-07-06 15:53:52 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-07-06 15:53:52 +0200 |
commit | 941e54654eabed0a3568f7fefe424a45aa02eddb (patch) | |
tree | 49aa02b174c428962d99142d8061267bfcd79e69 /dom/animation/test | |
parent | ad9ee72dcd7981bc47b3844a224d69fadfdfd8ef (diff) | |
parent | 0daa12376295d5d796256a116eb2a348a3a9273f (diff) | |
download | UXP-941e54654eabed0a3568f7fefe424a45aa02eddb.tar UXP-941e54654eabed0a3568f7fefe424a45aa02eddb.tar.gz UXP-941e54654eabed0a3568f7fefe424a45aa02eddb.tar.lz UXP-941e54654eabed0a3568f7fefe424a45aa02eddb.tar.xz UXP-941e54654eabed0a3568f7fefe424a45aa02eddb.zip |
Merge branch 'master' of https://github.com/MoonchildProductions/UXP into _testBranch_test_1
Diffstat (limited to 'dom/animation/test')
-rw-r--r-- | dom/animation/test/css-animations/file_event-dispatch.html | 252 | ||||
-rw-r--r-- | dom/animation/test/css-animations/file_event-order.html | 160 | ||||
-rw-r--r-- | dom/animation/test/css-animations/test_event-dispatch.html | 15 | ||||
-rw-r--r-- | dom/animation/test/css-animations/test_event-order.html (renamed from dom/animation/test/css-transitions/test_csstransition-events.html) | 3 | ||||
-rw-r--r-- | dom/animation/test/css-transitions/file_animation-cancel.html | 182 | ||||
-rw-r--r-- | dom/animation/test/css-transitions/file_csstransition-events.html | 223 | ||||
-rw-r--r-- | dom/animation/test/css-transitions/file_event-dispatch.html | 474 | ||||
-rw-r--r-- | dom/animation/test/css-transitions/file_setting-effect.html | 9 | ||||
-rw-r--r-- | dom/animation/test/css-transitions/test_event-dispatch.html | 14 | ||||
-rw-r--r-- | dom/animation/test/mochitest.ini | 6 |
10 files changed, 1057 insertions, 281 deletions
diff --git a/dom/animation/test/css-animations/file_event-dispatch.html b/dom/animation/test/css-animations/file_event-dispatch.html new file mode 100644 index 000000000..266205bc3 --- /dev/null +++ b/dom/animation/test/css-animations/file_event-dispatch.html @@ -0,0 +1,252 @@ +<!doctype html> +<meta charset=utf-8> +<title>Tests for CSS animation event dispatch</title> +<link rel="help" href="https://drafts.csswg.org/css-animations-2/#event-dispatch"/> +<script src="../testcommon.js"></script> +<style> + @keyframes anim { + from { margin-left: 0px; } + to { margin-left: 100px; } + } +</style> +<body> +<script> +'use strict'; + +/** + * Helper class to record the elapsedTime member of each event. + * The EventWatcher class in testharness.js allows us to wait on + * multiple events in a certain order but only records the event + * parameters of the most recent event. + */ +function AnimationEventHandler(target) { + this.target = target; + this.target.onanimationstart = function(evt) { + this.animationstart = evt.elapsedTime; + }.bind(this); + this.target.onanimationiteration = function(evt) { + this.animationiteration = evt.elapsedTime; + }.bind(this); + this.target.onanimationend = function(evt) { + this.animationend = evt.elapsedTime; + }.bind(this); +} +AnimationEventHandler.prototype.clear = function() { + this.animationstart = undefined; + this.animationiteration = undefined; + this.animationend = undefined; +} + +function setupAnimation(t, animationStyle) { + var div = addDiv(t, { style: "animation: " + animationStyle }); + var watcher = new EventWatcher(t, div, [ 'animationstart', + 'animationiteration', + 'animationend' ]); + var handler = new AnimationEventHandler(div); + var animation = div.getAnimations()[0]; + + return [animation, watcher, handler, div]; +} + +promise_test(function(t) { + // Add 1ms delay to ensure that the delay is not included in the elapsedTime. + const [animation, watcher] = setupAnimation(t, 'anim 100s 1ms'); + + return watcher.wait_for('animationstart').then(function(evt) { + assert_equals(evt.elapsedTime, 0.0); + }); +}, 'Idle -> Active'); + +promise_test(function(t) { + const [animation, watcher, handler] = setupAnimation(t, 'anim 100s'); + + // Seek to After phase. + animation.finish(); + return watcher.wait_for([ 'animationstart', + 'animationend' ]).then(function() { + assert_equals(handler.animationstart, 0.0); + assert_equals(handler.animationend, 100); + }); +}, 'Idle -> After'); + +promise_test(function(t) { + const [animation, watcher, handler] = + setupAnimation(t, 'anim 100s 100s paused'); + + return animation.ready.then(function() { + // Seek to Active phase. + animation.currentTime = 100 * MS_PER_SEC; + return watcher.wait_for('animationstart'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 0.0); + }); +}, 'Before -> Active'); + +promise_test(function(t) { + const [animation, watcher, handler] = + setupAnimation(t, 'anim 100s 100s paused'); + + return animation.ready.then(function() { + // Seek to After phase. + animation.finish(); + return watcher.wait_for([ 'animationstart', 'animationend' ]); + }).then(function(evt) { + assert_equals(handler.animationstart, 0.0); + assert_equals(handler.animationend, 100.0); + }); +}, 'Before -> After'); + +promise_test(function(t) { + const [animation, watcher, handler] = + setupAnimation(t, 'anim 100s 100s paused'); + + // Seek to Active phase. + animation.currentTime = 100 * MS_PER_SEC; + return watcher.wait_for('animationstart').then(function() { + // Seek to Before phase. + animation.currentTime = 0; + return watcher.wait_for('animationend'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 0.0); + }); +}, 'Active -> Before'); + +promise_test(function(t) { + const [animation, watcher, handler] = setupAnimation(t, 'anim 100s paused'); + + return watcher.wait_for('animationstart').then(function(evt) { + // Seek to After phase. + animation.finish(); + return watcher.wait_for('animationend'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 100.0); + }); +}, 'Active -> After'); + +promise_test(function(t) { + const [animation, watcher, handler] = + setupAnimation(t, 'anim 100s 100s paused'); + + // Seek to After phase. + animation.finish(); + return watcher.wait_for([ 'animationstart', + 'animationend' ]).then(function() { + // Seek to Before phase. + animation.currentTime = 0; + handler.clear(); + return watcher.wait_for([ 'animationstart', 'animationend' ]); + }).then(function() { + assert_equals(handler.animationstart, 100.0); + assert_equals(handler.animationend, 0.0); + }); +}, 'After -> Before'); + +promise_test(function(t) { + const [animation, watcher, handler] = + setupAnimation(t, 'anim 100s 100s paused'); + + // Seek to After phase. + animation.finish(); + return watcher.wait_for([ 'animationstart', + 'animationend' ]).then(function() { + // Seek to Active phase. + animation.currentTime = 100 * MS_PER_SEC; + handler.clear(); + return watcher.wait_for('animationstart'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 100.0); + }); +}, 'After -> Active'); + +promise_test(function(t) { + const [animation, watcher, handler] + = setupAnimation(t, 'anim 100s 100s 3 paused'); + + return animation.ready.then(function() { + // Seek to iteration 0 (no animationiteration event should be dispatched) + animation.currentTime = 100 * MS_PER_SEC; + return watcher.wait_for('animationstart'); + }).then(function(evt) { + // Seek to iteration 2 + animation.currentTime = 300 * MS_PER_SEC; + handler.clear(); + return watcher.wait_for('animationiteration'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 200); + // Seek to After phase (no animationiteration event should be dispatched) + animation.currentTime = 400 * MS_PER_SEC; + return watcher.wait_for('animationend'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 300); + }); +}, 'Active -> Active (forwards)'); + +promise_test(function(t) { + const [animation, watcher, handler] = setupAnimation(t, 'anim 100s 100s 3'); + + // Seek to After phase. + animation.finish(); + return watcher.wait_for([ 'animationstart', + 'animationend' ]).then(function() { + // Seek to iteration 2 (no animationiteration event should be dispatched) + animation.pause(); + animation.currentTime = 300 * MS_PER_SEC; + return watcher.wait_for('animationstart'); + }).then(function() { + // Seek to mid of iteration 0 phase. + animation.currentTime = 200 * MS_PER_SEC; + return watcher.wait_for('animationiteration'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 200.0); + // Seek to before phase (no animationiteration event should be dispatched) + animation.currentTime = 0; + return watcher.wait_for('animationend'); + }); +}, 'Active -> Active (backwards)'); + +promise_test(function(t) { + const [animation, watcher, handler, div] = + setupAnimation(t, 'anim 100s paused'); + return watcher.wait_for('animationstart').then(function(evt) { + // Seek to Idle phase. + div.style.display = 'none'; + flushComputedStyle(div); + + // FIXME: bug 1302648: Add test for animationcancel event here. + + // Restart this animation. + div.style.display = ''; + return watcher.wait_for('animationstart'); + }); +}, 'Active -> Idle -> Active: animationstart is fired by restarting animation'); + +promise_test(function(t) { + const [animation, watcher, handler, div] = + setupAnimation(t, 'anim 100s 100s 2 paused'); + + // Make After. + animation.finish(); + return watcher.wait_for([ 'animationstart', + 'animationend' ]).then(function(evt) { + animation.playbackRate = -1; + return watcher.wait_for('animationstart'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 200); + // Seek to 1st iteration + animation.currentTime = 200 * MS_PER_SEC - 1; + return watcher.wait_for('animationiteration'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 100); + // Seek to before + animation.currentTime = 100 * MS_PER_SEC - 1; + return watcher.wait_for('animationend'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 0); + assert_equals(animation.playState, 'running'); // delay + }); +}, 'Negative playbackRate sanity test(Before -> Active -> Before)'); + +done(); +</script> +</body> +</html> diff --git a/dom/animation/test/css-animations/file_event-order.html b/dom/animation/test/css-animations/file_event-order.html new file mode 100644 index 000000000..da78b6541 --- /dev/null +++ b/dom/animation/test/css-animations/file_event-order.html @@ -0,0 +1,160 @@ +<!doctype html> +<meta charset=utf-8> +<title>Tests for CSS animation event order</title> +<link rel="help" href="https://drafts.csswg.org/css-animations-2/#event-dispatch"/> +<script src="../testcommon.js"></script> +<style> + @keyframes anim { + from { margin-left: 0px; } + to { margin-left: 100px; } + } +</style> +<body> +<script type='text/javascript'> +'use strict'; + +/** + * Asserts that the set of actual and received events match. + * @param actualEvents An array of the received AnimationEvent objects. + * @param expectedEvents A series of array objects representing the expected + * events, each having the form: + * [ event type, target element, elapsed time ] + */ +function checkEvents(actualEvents, ...expectedEvents) { + assert_equals(actualEvents.length, expectedEvents.length, + `Number of actual events (${actualEvents.length}: \ +${actualEvents.map(event => event.type).join(', ')}) should match expected \ +events (${expectedEvents.map(event => event.type).join(', ')})`); + + actualEvents.forEach((actualEvent, i) => { + assert_equals(expectedEvents[i][0], actualEvent.type, + 'Event type should match'); + assert_equals(expectedEvents[i][1], actualEvent.target, + 'Event target should match'); + assert_equals(expectedEvents[i][2], actualEvent.elapsedTime, + 'Event\'s elapsed time should match'); + }); +} + +function setupAnimation(t, animationStyle, receiveEvents) { + const div = addDiv(t, { style: "animation: " + animationStyle }); + const watcher = new EventWatcher(t, div, [ 'animationstart', + 'animationiteration', + 'animationend' ]); + + ['start', 'iteration', 'end'].forEach(name => { + div['onanimation' + name] = function(evt) { + receiveEvents.push({ type: evt.type, + target: evt.target, + elapsedTime: evt.elapsedTime }); + }.bind(this); + }); + + const animation = div.getAnimations()[0]; + + return [animation, watcher, div]; +} + +promise_test(function(t) { + let events = []; + const [animation1, watcher1, div1] = + setupAnimation(t, 'anim 100s 2 paused', events); + const [animation2, watcher2, div2] = + setupAnimation(t, 'anim 100s 2 paused', events); + + return Promise.all([ watcher1.wait_for('animationstart'), + watcher2.wait_for('animationstart') ]).then(function() { + checkEvents(events, ['animationstart', div1, 0], + ['animationstart', div2, 0]); + + events.length = 0; // Clear received event array + + animation1.currentTime = 100 * MS_PER_SEC; + animation2.currentTime = 100 * MS_PER_SEC; + return Promise.all([ watcher1.wait_for('animationiteration'), + watcher2.wait_for('animationiteration') ]); + }).then(function() { + checkEvents(events, ['animationiteration', div1, 100], + ['animationiteration', div2, 100]); + + events.length = 0; // Clear received event array + + animation1.finish(); + animation2.finish(); + + return Promise.all([ watcher1.wait_for('animationend'), + watcher2.wait_for('animationend') ]); + }).then(function() { + checkEvents(events, ['animationend', div1, 200], + ['animationend', div2, 200]); + }); +}, 'Test same events are ordered by elements.'); + +promise_test(function(t) { + let events = []; + const [animation1, watcher1, div1] = + setupAnimation(t, 'anim 200s 400s', events); + const [animation2, watcher2, div2] = + setupAnimation(t, 'anim 300s 2', events); + + return watcher2.wait_for('animationstart').then(function(evt) { + animation1.currentTime = 400 * MS_PER_SEC; + animation2.currentTime = 400 * MS_PER_SEC; + + events.length = 0; // Clear received event array + + return Promise.all([ watcher1.wait_for('animationstart'), + watcher2.wait_for('animationiteration') ]); + }).then(function() { + checkEvents(events, ['animationiteration', div2, 300], + ['animationstart', div1, 0]); + }); +}, 'Test start and iteration events are ordered by time.'); + +promise_test(function(t) { + let events = []; + const [animation1, watcher1, div1] = + setupAnimation(t, 'anim 150s', events); + const [animation2, watcher2, div2] = + setupAnimation(t, 'anim 100s 2', events); + + return Promise.all([ watcher1.wait_for('animationstart'), + watcher2.wait_for('animationstart') ]).then(function() { + animation1.currentTime = 150 * MS_PER_SEC; + animation2.currentTime = 150 * MS_PER_SEC; + + events.length = 0; // Clear received event array + + return Promise.all([ watcher1.wait_for('animationend'), + watcher2.wait_for('animationiteration') ]); + }).then(function() { + checkEvents(events, ['animationiteration', div2, 100], + ['animationend', div1, 150]); + }); +}, 'Test iteration and end events are ordered by time.'); + +promise_test(function(t) { + let events = []; + const [animation1, watcher1, div1] = + setupAnimation(t, 'anim 100s 100s', events); + const [animation2, watcher2, div2] = + setupAnimation(t, 'anim 100s 2', events); + + animation1.finish(); + animation2.finish(); + + return Promise.all([ watcher1.wait_for([ 'animationstart', + 'animationend' ]), + watcher2.wait_for([ 'animationstart', + 'animationend' ]) ]).then(function() { + checkEvents(events, ['animationstart', div2, 0], + ['animationstart', div1, 0], + ['animationend', div1, 100], + ['animationend', div2, 200]); + }); +}, 'Test start and end events are sorted correctly when fired simultaneously'); + +done(); +</script> +</body> +</html> diff --git a/dom/animation/test/css-animations/test_event-dispatch.html b/dom/animation/test/css-animations/test_event-dispatch.html new file mode 100644 index 000000000..de3be0301 --- /dev/null +++ b/dom/animation/test/css-animations/test_event-dispatch.html @@ -0,0 +1,15 @@ +<!doctype html> +<meta charset=utf-8> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +'use strict'; +setup({explicit_done: true}); +SpecialPowers.pushPrefEnv( + { "set": [["dom.animations-api.core.enabled", true]]}, + function() { + window.open("file_event-dispatch.html"); + }); +</script> +</html> diff --git a/dom/animation/test/css-transitions/test_csstransition-events.html b/dom/animation/test/css-animations/test_event-order.html index 92559ad67..57f1f3876 100644 --- a/dom/animation/test/css-transitions/test_csstransition-events.html +++ b/dom/animation/test/css-animations/test_event-order.html @@ -9,6 +9,7 @@ setup({explicit_done: true}); SpecialPowers.pushPrefEnv( { "set": [["dom.animations-api.core.enabled", true]]}, function() { - window.open("file_csstransition-events.html"); + window.open("file_event-order.html"); }); </script> +</html> diff --git a/dom/animation/test/css-transitions/file_animation-cancel.html b/dom/animation/test/css-transitions/file_animation-cancel.html index 6094b383f..71f02fb11 100644 --- a/dom/animation/test/css-transitions/file_animation-cancel.html +++ b/dom/animation/test/css-transitions/file_animation-cancel.html @@ -11,13 +11,12 @@ promise_test(function(t) { div.style.transition = 'margin-left 100s'; div.style.marginLeft = '1000px'; - flushComputedStyle(div); - var animation = div.getAnimations()[0]; - return animation.ready.then(waitForFrame).then(function() { + var transition = div.getAnimations()[0]; + return transition.ready.then(waitForFrame).then(function() { assert_not_equals(getComputedStyle(div).marginLeft, '1000px', 'transform style is animated before cancelling'); - animation.cancel(); + transition.cancel(); assert_equals(getComputedStyle(div).marginLeft, div.style.marginLeft, 'transform style is no longer animated after cancelling'); }); @@ -29,45 +28,21 @@ promise_test(function(t) { div.style.transition = 'margin-left 100s'; div.style.marginLeft = '1000px'; - flushComputedStyle(div); - - div.addEventListener('transitionend', function() { - assert_unreached('Got unexpected end event on cancelled transition'); - }); - - var animation = div.getAnimations()[0]; - return animation.ready.then(function() { - // Seek to just before the end then cancel - animation.currentTime = 99.9 * 1000; - animation.cancel(); - // Then wait a couple of frames and check that no event was dispatched - return waitForAnimationFrames(2); - }); -}, 'Cancelled CSS transitions do not dispatch events'); - -promise_test(function(t) { - var div = addDiv(t, { style: 'margin-left: 0px' }); - flushComputedStyle(div); - - div.style.transition = 'margin-left 100s'; - div.style.marginLeft = '1000px'; - flushComputedStyle(div); - - var animation = div.getAnimations()[0]; - return animation.ready.then(function() { - animation.cancel(); + var transition = div.getAnimations()[0]; + return transition.ready.then(function() { + transition.cancel(); assert_equals(getComputedStyle(div).marginLeft, '1000px', 'margin-left style is not animated after cancelling'); - animation.play(); + transition.play(); assert_equals(getComputedStyle(div).marginLeft, '0px', 'margin-left style is animated after re-starting transition'); - return animation.ready; + return transition.ready; }).then(function() { - assert_equals(animation.playState, 'running', + assert_equals(transition.playState, 'running', 'Transition succeeds in running after being re-started'); }); -}, 'After cancelling a transition, it can still be re-used'); +}, 'After canceling a transition, it can still be re-used'); promise_test(function(t) { var div = addDiv(t, { style: 'margin-left: 0px' }); @@ -75,20 +50,19 @@ promise_test(function(t) { div.style.transition = 'margin-left 100s'; div.style.marginLeft = '1000px'; - flushComputedStyle(div); - var animation = div.getAnimations()[0]; - return animation.ready.then(function() { - animation.finish(); - animation.cancel(); + var transition = div.getAnimations()[0]; + return transition.ready.then(function() { + transition.finish(); + transition.cancel(); assert_equals(getComputedStyle(div).marginLeft, '1000px', 'margin-left style is not animated after cancelling'); - animation.play(); + transition.play(); assert_equals(getComputedStyle(div).marginLeft, '0px', 'margin-left style is animated after re-starting transition'); - return animation.ready; + return transition.ready; }).then(function() { - assert_equals(animation.playState, 'running', + assert_equals(transition.playState, 'running', 'Transition succeeds in running after being re-started'); }); }, 'After cancelling a finished transition, it can still be re-used'); @@ -99,10 +73,9 @@ test(function(t) { div.style.transition = 'margin-left 100s'; div.style.marginLeft = '1000px'; - flushComputedStyle(div); - var animation = div.getAnimations()[0]; - animation.cancel(); + var transition = div.getAnimations()[0]; + transition.cancel(); assert_equals(getComputedStyle(div).marginLeft, '1000px', 'margin-left style is not animated after cancelling'); @@ -113,7 +86,7 @@ test(function(t) { assert_equals(getComputedStyle(div).marginLeft, '1000px', 'margin-left style is still not animated after updating' + ' transition-duration'); - assert_equals(animation.playState, 'idle', + assert_equals(transition.playState, 'idle', 'Transition is still idle after updating transition-duration'); }, 'After cancelling a transition, updating transition properties doesn\'t make' + ' it live again'); @@ -124,15 +97,14 @@ promise_test(function(t) { div.style.transition = 'margin-left 100s'; div.style.marginLeft = '1000px'; - flushComputedStyle(div); - var animation = div.getAnimations()[0]; - return animation.ready.then(function() { - assert_equals(animation.playState, 'running'); + var transition = div.getAnimations()[0]; + return transition.ready.then(function() { + assert_equals(transition.playState, 'running'); div.style.display = 'none'; return waitForFrame(); }).then(function() { - assert_equals(animation.playState, 'idle'); + assert_equals(transition.playState, 'idle'); assert_equals(getComputedStyle(div).marginLeft, '1000px'); }); }, 'Setting display:none on an element cancels its transitions'); @@ -147,19 +119,115 @@ promise_test(function(t) { childDiv.style.transition = 'margin-left 100s'; childDiv.style.marginLeft = '1000px'; - flushComputedStyle(childDiv); - var animation = childDiv.getAnimations()[0]; - return animation.ready.then(function() { - assert_equals(animation.playState, 'running'); + var transition = childDiv.getAnimations()[0]; + return transition.ready.then(function() { + assert_equals(transition.playState, 'running'); parentDiv.style.display = 'none'; return waitForFrame(); }).then(function() { - assert_equals(animation.playState, 'idle'); + assert_equals(transition.playState, 'idle'); assert_equals(getComputedStyle(childDiv).marginLeft, '1000px'); }); }, 'Setting display:none cancels transitions on a child element'); +promise_test(function(t) { + var div = addDiv(t, { style: 'margin-left: 0px' }); + flushComputedStyle(div); + + div.style.transition = 'margin-left 100s'; + div.style.marginLeft = '1000px'; + + var transition = div.getAnimations()[0]; + return transition.ready.then(function() { + assert_equals(transition.playState, 'running'); + // Set an unrecognized property value + div.style.transitionProperty = 'none'; + flushComputedStyle(div); + return waitForFrame(); + }).then(function() { + assert_equals(transition.playState, 'idle'); + assert_equals(getComputedStyle(div).marginLeft, '1000px'); + }); +}, 'Removing a property from transition-property cancels transitions on that '+ + 'property'); + +promise_test(function(t) { + var div = addDiv(t, { style: 'margin-left: 0px' }); + flushComputedStyle(div); + + div.style.transition = 'margin-left 100s'; + div.style.marginLeft = '1000px'; + + var transition = div.getAnimations()[0]; + return transition.ready.then(function() { + assert_equals(transition.playState, 'running'); + div.style.transition = 'margin-top 10s -10s'; // combined duration is zero + flushComputedStyle(div); + return waitForFrame(); + }).then(function() { + assert_equals(transition.playState, 'idle'); + assert_equals(getComputedStyle(div).marginLeft, '1000px'); + }); +}, 'Setting zero combined duration'); + +promise_test(function(t) { + var div = addDiv(t, { style: 'margin-left: 0px' }); + flushComputedStyle(div); + + div.style.transition = 'margin-left 100s'; + div.style.marginLeft = '1000px'; + + var transition = div.getAnimations()[0]; + return transition.ready.then(function() { + assert_equals(transition.playState, 'running'); + div.style.marginLeft = '2000px'; + flushComputedStyle(div); + return waitForFrame(); + }).then(function() { + assert_equals(transition.playState, 'idle'); + }); +}, 'Changing style to another interpolable value cancels the original ' + + 'transition'); + +promise_test(function(t) { + var div = addDiv(t, { style: 'margin-left: 0px' }); + flushComputedStyle(div); + + div.style.transition = 'margin-left 100s'; + div.style.marginLeft = '1000px'; + + var transition = div.getAnimations()[0]; + return transition.ready.then(function() { + assert_equals(transition.playState, 'running'); + div.style.marginLeft = 'auto'; + flushComputedStyle(div); + return waitForFrame(); + }).then(function() { + assert_equals(div.getAnimations().length, 0, + 'There should be no transitions'); + assert_equals(transition.playState, 'idle'); + }); +}, 'An after-change style value can\'t be interpolated'); + +promise_test(function(t) { + var div = addDiv(t, { style: 'margin-left: 0px' }); + flushComputedStyle(div); + + div.style.transition = 'margin-left 100s'; + div.style.marginLeft = '1000px'; + + var transition = div.getAnimations()[0]; + return transition.ready.then(function() { + assert_equals(transition.playState, 'running'); + div.style.marginLeft = '0px'; + flushComputedStyle(div); + return waitForFrame(); + }).then(function() { + assert_equals(transition.playState, 'idle'); + }); +}, 'Reversing a running transition cancels the original transition'); + done(); </script> </body> diff --git a/dom/animation/test/css-transitions/file_csstransition-events.html b/dom/animation/test/css-transitions/file_csstransition-events.html deleted file mode 100644 index 5011bc130..000000000 --- a/dom/animation/test/css-transitions/file_csstransition-events.html +++ /dev/null @@ -1,223 +0,0 @@ -<!doctype html> -<meta charset=utf-8> -<title>Tests for CSS-Transition events</title> -<link rel="help" href="https://drafts.csswg.org/css-transitions-2/#transition-events"> -<script src="../testcommon.js"></script> -<body> -<script> -'use strict'; - -/** - * Helper class to record the elapsedTime member of each event. - * The EventWatcher class in testharness.js allows us to wait on - * multiple events in a certain order but only records the event - * parameters of the most recent event. - */ -function TransitionEventHandler(target) { - this.target = target; - this.target.ontransitionrun = function(evt) { - this.transitionrun = evt.elapsedTime; - }.bind(this); - this.target.ontransitionstart = function(evt) { - this.transitionstart = evt.elapsedTime; - }.bind(this); - this.target.ontransitionend = function(evt) { - this.transitionend = evt.elapsedTime; - }.bind(this); -} - -TransitionEventHandler.prototype.clear = function() { - this.transitionrun = undefined; - this.transitionstart = undefined; - this.transitionend = undefined; -}; - -function setupTransition(t, transitionStyle) { - var div, watcher, handler, transition; - transitionStyle = transitionStyle || 'transition: margin-left 100s 100s'; - div = addDiv(t, { style: transitionStyle }); - watcher = new EventWatcher(t, div, [ 'transitionrun', - 'transitionstart', - 'transitionend' ]); - handler = new TransitionEventHandler(div); - flushComputedStyle(div); - - div.style.marginLeft = '100px'; - flushComputedStyle(div); - - transition = div.getAnimations()[0]; - - return [transition, watcher, handler]; -} - -// On the next frame (i.e. when events are queued), whether or not the -// transition is still pending depends on the implementation. -promise_test(function(t) { - var [transition, watcher, handler] = setupTransition(t); - return watcher.wait_for('transitionrun').then(function(evt) { - assert_equals(evt.elapsedTime, 0.0); - }); -}, 'Idle -> Pending or Before'); - -promise_test(function(t) { - var [transition, watcher, handler] = setupTransition(t); - // Force the transition to leave the idle phase - transition.startTime = document.timeline.currentTime; - return watcher.wait_for('transitionrun').then(function(evt) { - assert_equals(evt.elapsedTime, 0.0); - }); -}, 'Idle -> Before'); - -promise_test(function(t) { - var [transition, watcher, handler] = setupTransition(t); - // Seek to Active phase. - transition.currentTime = 100 * MS_PER_SEC; - transition.pause(); - return watcher.wait_for([ 'transitionrun', - 'transitionstart' ]).then(function(evt) { - assert_equals(handler.transitionrun, 0.0); - assert_equals(handler.transitionstart, 0.0); - }); -}, 'Idle or Pending -> Active'); - -promise_test(function(t) { - var [transition, watcher, handler] = setupTransition(t); - // Seek to After phase. - transition.finish(); - return watcher.wait_for([ 'transitionrun', - 'transitionstart', - 'transitionend' ]).then(function(evt) { - 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); - - 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); - }); -}, 'Before -> Active'); - -promise_test(function(t) { - var [transition, watcher, handler] = setupTransition(t); - return Promise.all([ watcher.wait_for('transitionrun'), - transition.ready ]).then(function() { - // Seek to After phase. - transition.currentTime = 200 * MS_PER_SEC; - return watcher.wait_for([ 'transitionstart', 'transitionend' ]); - }).then(function(evt) { - assert_equals(handler.transitionstart, 0.0); - assert_equals(handler.transitionend, 100.0); - }); -}, '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 Before phase. - transition.currentTime = 0; - return watcher.wait_for('transitionend'); - }).then(function(evt) { - assert_equals(evt.elapsedTime, 0.0); - }); -}, 'Active -> Before'); - -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 After phase. - transition.currentTime = 200 * MS_PER_SEC; - return watcher.wait_for('transitionend'); - }).then(function(evt) { - assert_equals(evt.elapsedTime, 100.0); - }); -}, 'Active -> After'); - -promise_test(function(t) { - var [transition, watcher, handler] = setupTransition(t); - // Seek to After phase. - transition.finish(); - return watcher.wait_for([ 'transitionrun', - 'transitionstart', - 'transitionend' ]).then(function(evt) { - // Seek to Before phase. - transition.currentTime = 0; - return watcher.wait_for([ 'transitionstart', 'transitionend' ]); - }).then(function(evt) { - assert_equals(handler.transitionstart, 100.0); - assert_equals(handler.transitionend, 0.0); - }); -}, 'After -> Before'); - -promise_test(function(t) { - var [transition, watcher, handler] = setupTransition(t); - // Seek to After phase. - transition.finish(); - return watcher.wait_for([ 'transitionrun', - 'transitionstart', - 'transitionend' ]).then(function(evt) { - // Seek to Active phase. - transition.currentTime = 100 * MS_PER_SEC; - return watcher.wait_for('transitionstart'); - }).then(function(evt) { - assert_equals(evt.elapsedTime, 100.0); - }); -}, 'After -> Active'); - -promise_test(function(t) { - var [transition, watcher, handler] = - setupTransition(t, 'transition: margin-left 100s -50s'); - - return watcher.wait_for([ 'transitionrun', - 'transitionstart' ]).then(function() { - assert_equals(handler.transitionrun, 50.0); - assert_equals(handler.transitionstart, 50.0); - transition.finish(); - return watcher.wait_for('transitionend'); - }).then(function(evt) { - assert_equals(evt.elapsedTime, 100.0); - }); -}, 'Calculating the interval start and end time with negative start delay.'); - -promise_test(function(t) { - var [transition, watcher, handler] = setupTransition(t); - - return watcher.wait_for('transitionrun').then(function(evt) { - // We can't set the end delay via generated effect timing. - // Because CSS-Transition use the AnimationEffectTimingReadOnly. - transition.effect = new KeyframeEffect(handler.target, - { marginleft: [ '0px', '100px' ]}, - { duration: 100 * MS_PER_SEC, - endDelay: -50 * MS_PER_SEC }); - // Seek to Before and play. - transition.cancel(); - transition.play(); - return watcher.wait_for('transitionstart'); - }).then(function() { - assert_equals(handler.transitionstart, 0.0); - - // Seek to After phase. - transition.finish(); - return watcher.wait_for('transitionend'); - }).then(function(evt) { - assert_equals(evt.elapsedTime, 50.0); - }); -}, 'Calculating the interval start and end time with negative end delay.'); - -done(); -</script> -</body> -</html> diff --git a/dom/animation/test/css-transitions/file_event-dispatch.html b/dom/animation/test/css-transitions/file_event-dispatch.html new file mode 100644 index 000000000..7140cda36 --- /dev/null +++ b/dom/animation/test/css-transitions/file_event-dispatch.html @@ -0,0 +1,474 @@ +<!doctype html> +<meta charset=utf-8> +<title>Tests for CSS-Transition events</title> +<link rel="help" href="https://drafts.csswg.org/css-transitions-2/#transition-events"> +<script src="../testcommon.js"></script> +<body> +<script> +'use strict'; + +/** + * Helper class to record the elapsedTime member of each event. + * The EventWatcher class in testharness.js allows us to wait on + * multiple events in a certain order but only records the event + * parameters of the most recent event. + */ +function TransitionEventHandler(target) { + this.target = target; + this.target.ontransitionrun = function(evt) { + this.transitionrun = evt.elapsedTime; + }.bind(this); + this.target.ontransitionstart = function(evt) { + this.transitionstart = evt.elapsedTime; + }.bind(this); + this.target.ontransitionend = function(evt) { + this.transitionend = evt.elapsedTime; + }.bind(this); + this.target.ontransitioncancel = function(evt) { + this.transitioncancel = evt.elapsedTime; + }.bind(this); +} + +TransitionEventHandler.prototype.clear = function() { + this.transitionrun = undefined; + this.transitionstart = undefined; + this.transitionend = undefined; + this.transitioncancel = undefined; +}; + +function setupTransition(t, transitionStyle) { + var div = addDiv(t, { style: 'transition: ' + transitionStyle }); + var watcher = new EventWatcher(t, div, [ 'transitionrun', + 'transitionstart', + 'transitionend', + 'transitioncancel' ]); + flushComputedStyle(div); + + div.style.marginLeft = '100px'; + var transition = div.getAnimations()[0]; + + return [transition, watcher, div]; +} + +// On the next frame (i.e. when events are queued), whether or not the +// transition is still pending depends on the implementation. +promise_test(function(t) { + var [transition, watcher] = + setupTransition(t, 'margin-left 100s 100s'); + return watcher.wait_for('transitionrun').then(function(evt) { + assert_equals(evt.elapsedTime, 0.0); + }); +}, 'Idle -> Pending or Before'); + +promise_test(function(t) { + var [transition, watcher] = + setupTransition(t, 'margin-left 100s 100s'); + // Force the transition to leave the idle phase + transition.startTime = document.timeline.currentTime; + return watcher.wait_for('transitionrun').then(function(evt) { + assert_equals(evt.elapsedTime, 0.0); + }); +}, 'Idle -> Before'); + +promise_test(function(t) { + var [transition, watcher, div] = + setupTransition(t, 'margin-left 100s 100s'); + var handler = new TransitionEventHandler(div); + + // Seek to Active phase. + transition.currentTime = 100 * MS_PER_SEC; + transition.pause(); + return watcher.wait_for([ 'transitionrun', + 'transitionstart' ]).then(function(evt) { + assert_equals(handler.transitionrun, 0.0); + assert_equals(handler.transitionstart, 0.0); + }); +}, 'Idle or Pending -> Active'); + +promise_test(function(t) { + var [transition, watcher, div] = + setupTransition(t, 'margin-left 100s 100s'); + var handler = new TransitionEventHandler(div); + + // Seek to After phase. + transition.finish(); + return watcher.wait_for([ 'transitionrun', + 'transitionstart', + 'transitionend' ]).then(function(evt) { + 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, div] = + setupTransition(t, 'margin-left 100s 100s'); + + return Promise.all([ watcher.wait_for('transitionrun'), + transition.ready ]).then(function() { + // Make idle + div.style.display = 'none'; + flushComputedStyle(div); + return watcher.wait_for('transitioncancel'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 0.0); + }); +}, 'Before -> Idle (display: none)'); + +promise_test(function(t) { + var [transition, watcher] = + setupTransition(t, 'margin-left 100s 100s'); + + return Promise.all([ watcher.wait_for('transitionrun'), + transition.ready ]).then(function() { + // Make idle + transition.timeline = null; + return watcher.wait_for('transitioncancel'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 0.0); + }); +}, 'Before -> Idle (Animation.timeline = null)'); + +promise_test(function(t) { + var [transition, watcher] = + setupTransition(t, 'margin-left 100s 100s'); + + return Promise.all([ watcher.wait_for('transitionrun'), + transition.ready ]).then(function() { + transition.currentTime = 100 * MS_PER_SEC; + return watcher.wait_for('transitionstart'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 0.0); + }); +}, 'Before -> Active'); + +promise_test(function(t) { + var [transition, watcher, div] = + setupTransition(t, 'margin-left 100s 100s'); + var handler = new TransitionEventHandler(div); + + return Promise.all([ watcher.wait_for('transitionrun'), + transition.ready ]).then(function() { + // Seek to After phase. + transition.currentTime = 200 * MS_PER_SEC; + return watcher.wait_for([ 'transitionstart', 'transitionend' ]); + }).then(function(evt) { + assert_equals(handler.transitionstart, 0.0); + assert_equals(handler.transitionend, 100.0); + }); +}, 'Before -> After'); + +promise_test(function(t) { + var [transition, watcher, div] = + setupTransition(t, 'margin-left 100s'); + + // Seek to Active start position. + transition.pause(); + return watcher.wait_for([ 'transitionrun', + 'transitionstart' ]).then(function(evt) { + // Make idle + div.style.display = 'none'; + flushComputedStyle(div); + return watcher.wait_for('transitioncancel'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 0.0); + }); +}, 'Active -> Idle, no delay (display: none)'); + +promise_test(function(t) { + var [transition, watcher] = + setupTransition(t, 'margin-left 100s'); + + return watcher.wait_for([ 'transitionrun', + 'transitionstart' ]).then(function(evt) { + // Make idle + transition.currentTime = 0; + transition.timeline = null; + return watcher.wait_for('transitioncancel'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 0.0); + }); +}, 'Active -> Idle, no delay (Animation.timeline = null)'); + +promise_test(function(t) { + var [transition, watcher, div] = + setupTransition(t, 'margin-left 100s 100s'); + // Pause so the currentTime is fixed and we can accurately compare the event + // time in transition cancel events. + transition.pause(); + + // Seek to Active phase. + transition.currentTime = 100 * MS_PER_SEC; + return watcher.wait_for([ 'transitionrun', + 'transitionstart' ]).then(function(evt) { + // Make idle + div.style.display = 'none'; + flushComputedStyle(div); + return watcher.wait_for('transitioncancel'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 0.0); + }); +}, 'Active -> Idle, with positive delay (display: none)'); + +promise_test(function(t) { + var [transition, watcher] = + setupTransition(t, 'margin-left 100s 100s'); + + // Seek to Active phase. + transition.currentTime = 100 * MS_PER_SEC; + return watcher.wait_for([ 'transitionrun', + 'transitionstart' ]).then(function(evt) { + // Make idle + transition.currentTime = 100 * MS_PER_SEC; + transition.timeline = null; + return watcher.wait_for('transitioncancel'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 0.0); + }); +}, 'Active -> Idle, with positive delay (Animation.timeline = null)'); + +promise_test(function(t) { + var [transition, watcher, div] = + setupTransition(t, 'margin-left 100s -50s'); + + // Pause so the currentTime is fixed and we can accurately compare the event + // time in transition cancel events. + transition.pause(); + + return watcher.wait_for([ 'transitionrun', + 'transitionstart' ]).then(function(evt) { + // Make idle + div.style.display = 'none'; + flushComputedStyle(div); + return watcher.wait_for('transitioncancel'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 50.0); + }); +}, 'Active -> Idle, with negative delay (display: none)'); + +promise_test(function(t) { + var [transition, watcher] = + setupTransition(t, 'margin-left 100s -50s'); + + return watcher.wait_for([ 'transitionrun', + 'transitionstart' ]).then(function(evt) { + // Make idle + transition.currentTime = 50 * MS_PER_SEC; + transition.timeline = null; + return watcher.wait_for('transitioncancel'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 0.0); + }); +}, 'Active -> Idle, with negative delay (Animation.timeline = null)'); + +promise_test(function(t) { + var [transition, watcher] = + setupTransition(t, 'margin-left 100s 100s'); + // 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'); + +promise_test(function(t) { + var [transition, watcher] = + setupTransition(t, 'margin-left 100s 100s'); + // Seek to Active phase. + transition.currentTime = 100 * MS_PER_SEC; + return watcher.wait_for([ 'transitionrun', + 'transitionstart' ]).then(function(evt) { + // Seek to After phase. + transition.currentTime = 200 * MS_PER_SEC; + return watcher.wait_for('transitionend'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 100.0); + }); +}, 'Active -> After'); + +promise_test(function(t) { + var [transition, watcher, div] = + setupTransition(t, 'margin-left 100s 100s'); + var handler = new TransitionEventHandler(div); + + // Seek to After phase. + transition.finish(); + return watcher.wait_for([ 'transitionrun', + 'transitionstart', + 'transitionend' ]).then(function(evt) { + // Seek to Before phase. + transition.currentTime = 0; + return watcher.wait_for([ 'transitionstart', 'transitionend' ]); + }).then(function(evt) { + assert_equals(handler.transitionstart, 100.0); + assert_equals(handler.transitionend, 0.0); + }); +}, 'After -> Before'); + +promise_test(function(t) { + var [transition, watcher] = + setupTransition(t, 'margin-left 100s 100s'); + // Seek to After phase. + transition.finish(); + return watcher.wait_for([ 'transitionrun', + 'transitionstart', + 'transitionend' ]).then(function(evt) { + // Seek to Active phase. + transition.currentTime = 100 * MS_PER_SEC; + return watcher.wait_for('transitionstart'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 100.0); + }); +}, 'After -> Active'); + +promise_test(function(t) { + var [transition, watcher, div] = + setupTransition(t, 'margin-left 100s -50s'); + var handler = new TransitionEventHandler(div); + + return watcher.wait_for([ 'transitionrun', + 'transitionstart' ]).then(function() { + assert_equals(handler.transitionrun, 50.0); + assert_equals(handler.transitionstart, 50.0); + transition.finish(); + return watcher.wait_for('transitionend'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 100.0); + }); +}, 'Calculating the interval start and end time with negative start delay.'); + +promise_test(function(t) { + var [transition, watcher, div] = + setupTransition(t, 'margin-left 100s 100s'); + var handler = new TransitionEventHandler(div); + + return watcher.wait_for('transitionrun').then(function(evt) { + // We can't set the end delay via generated effect timing. + // Because CSS-Transition use the AnimationEffectTimingReadOnly. + transition.effect = new KeyframeEffect(div, + { marginleft: [ '0px', '100px' ]}, + { duration: 100 * MS_PER_SEC, + endDelay: -50 * MS_PER_SEC }); + // Seek to Before and play. + transition.cancel(); + transition.play(); + return watcher.wait_for([ 'transitioncancel', + 'transitionrun', + 'transitionstart' ]); + }).then(function() { + assert_equals(handler.transitionstart, 0.0); + + // Seek to After phase. + transition.finish(); + return watcher.wait_for('transitionend'); + }).then(function(evt) { + assert_equals(evt.elapsedTime, 50.0); + }); +}, 'Calculating the interval start and end time with negative end delay.'); + +promise_test(function(t) { + var [transition, watcher, div] = + setupTransition(t, 'margin-left 100s 100s'); + + return watcher.wait_for('transitionrun').then(function() { + // Make idle + div.style.display = 'none'; + flushComputedStyle(div); + return watcher.wait_for('transitioncancel'); + }).then(function() { + transition.cancel(); + // Then wait a couple of frames and check that no event was dispatched + return waitForAnimationFrames(2); + }); +}, 'Call Animation.cancel after cancelling transition.'); + +promise_test(function(t) { + var [transition, watcher, div] = + setupTransition(t, 'margin-left 100s 100s'); + + return watcher.wait_for('transitionrun').then(function(evt) { + // Make idle + div.style.display = 'none'; + flushComputedStyle(div); + transition.play(); + watcher.wait_for([ 'transitioncancel', + 'transitionrun', + 'transitionstart' ]); + }); +}, 'Restart transition after cancelling transition immediately'); + +promise_test(function(t) { + var [transition, watcher, div] = + setupTransition(t, 'margin-left 100s 100s'); + + return watcher.wait_for('transitionrun').then(function(evt) { + // Make idle + div.style.display = 'none'; + flushComputedStyle(div); + transition.play(); + transition.cancel(); + return watcher.wait_for('transitioncancel'); + }).then(function(evt) { + // Then wait a couple of frames and check that no event was dispatched + return waitForAnimationFrames(2); + }); +}, 'Call Animation.cancel after restarting transition immediately'); + +promise_test(function(t) { + var [transition, watcher] = + setupTransition(t, 'margin-left 100s'); + + return watcher.wait_for([ 'transitionrun', + 'transitionstart' ]).then(function(evt) { + // Make idle + transition.timeline = null; + return watcher.wait_for('transitioncancel'); + }).then(function(evt) { + transition.timeline = document.timeline; + transition.play(); + + return watcher.wait_for(['transitionrun', 'transitionstart']); + }); +}, 'Set timeline and play transition after clear the timeline'); + +promise_test(function(t) { + var [transition, watcher, div] = + setupTransition(t, 'margin-left 100s'); + + return watcher.wait_for([ 'transitionrun', + 'transitionstart' ]).then(function() { + transition.cancel(); + return watcher.wait_for('transitioncancel'); + }).then(function() { + // Make After phase + transition.effect = null; + + // Then wait a couple of frames and check that no event was dispatched + return waitForAnimationFrames(2); + }); +}, 'Set null target effect after cancel the transition'); + +promise_test(function(t) { + var [transition, watcher, div] = + setupTransition(t, 'margin-left 100s'); + + return watcher.wait_for([ 'transitionrun', + 'transitionstart' ]).then(function(evt) { + transition.effect = null; + return watcher.wait_for('transitionend'); + }).then(function(evt) { + transition.cancel(); + return watcher.wait_for('transitioncancel'); + }); +}, 'Cancel the transition after clearing the target effect'); + +done(); +</script> +</body> +</html> diff --git a/dom/animation/test/css-transitions/file_setting-effect.html b/dom/animation/test/css-transitions/file_setting-effect.html index c61877194..81279ea55 100644 --- a/dom/animation/test/css-transitions/file_setting-effect.html +++ b/dom/animation/test/css-transitions/file_setting-effect.html @@ -7,6 +7,8 @@ promise_test(function(t) { var div = addDiv(t); + var watcher = new EventWatcher(t, div, [ 'transitionend', + 'transitioncancel' ]); div.style.left = '0px'; div.style.transition = 'left 100s'; @@ -20,11 +22,14 @@ promise_test(function(t) { assert_equals(transition.transitionProperty, 'left'); assert_equals(transition.playState, 'finished'); assert_equals(window.getComputedStyle(div).left, '100px'); + return watcher.wait_for('transitionend'); }); }, 'Test for removing a transition effect'); promise_test(function(t) { var div = addDiv(t); + var watcher = new EventWatcher(t, div, [ 'transitionend', + 'transitioncancel' ]); div.style.left = '0px'; div.style.transition = 'left 100s'; @@ -46,6 +51,8 @@ promise_test(function(t) { promise_test(function(t) { var div = addDiv(t); + var watcher = new EventWatcher(t, div, [ 'transitionend', + 'transitioncancel' ]); div.style.left = '0px'; div.style.width = '0px'; @@ -65,6 +72,8 @@ promise_test(function(t) { promise_test(function(t) { var div = addDiv(t); + var watcher = new EventWatcher(t, div, [ 'transitionend', + 'transitioncancel' ]); div.style.left = '0px'; div.style.width = '0px'; diff --git a/dom/animation/test/css-transitions/test_event-dispatch.html b/dom/animation/test/css-transitions/test_event-dispatch.html new file mode 100644 index 000000000..c90431cd1 --- /dev/null +++ b/dom/animation/test/css-transitions/test_event-dispatch.html @@ -0,0 +1,14 @@ +<!doctype html> +<meta charset=utf-8> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +'use strict'; +setup({explicit_done: true}); +SpecialPowers.pushPrefEnv( + { "set": [["dom.animations-api.core.enabled", true]]}, + function() { + window.open("file_event-dispatch.html"); + }); +</script> diff --git a/dom/animation/test/mochitest.ini b/dom/animation/test/mochitest.ini index feb424518..db6dffada 100644 --- a/dom/animation/test/mochitest.ini +++ b/dom/animation/test/mochitest.ini @@ -19,6 +19,8 @@ support-files = css-animations/file_document-get-animations.html css-animations/file_effect-target.html css-animations/file_element-get-animations.html + css-animations/file_event-dispatch.html + css-animations/file_event-order.html css-animations/file_keyframeeffect-getkeyframes.html css-animations/file_pseudoElement-get-animations.html css-transitions/file_animation-cancel.html @@ -32,6 +34,7 @@ support-files = css-transitions/file_document-get-animations.html css-transitions/file_effect-target.html css-transitions/file_element-get-animations.html + css-transitions/file_event-dispatch.html css-transitions/file_keyframeeffect-getkeyframes.html css-transitions/file_pseudoElement-get-animations.html css-transitions/file_setting-effect.html @@ -72,6 +75,8 @@ support-files = [css-animations/test_document-get-animations.html] [css-animations/test_effect-target.html] [css-animations/test_element-get-animations.html] +[css-animations/test_event-dispatch.html] +[css-animations/test_event-order.html] [css-animations/test_keyframeeffect-getkeyframes.html] [css-animations/test_pseudoElement-get-animations.html] [css-transitions/test_animation-cancel.html] @@ -85,6 +90,7 @@ support-files = [css-transitions/test_document-get-animations.html] [css-transitions/test_effect-target.html] [css-transitions/test_element-get-animations.html] +[css-transitions/test_event-dispatch.html] [css-transitions/test_keyframeeffect-getkeyframes.html] [css-transitions/test_pseudoElement-get-animations.html] [css-transitions/test_setting-effect.html] |