mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1302007 part 1 - Use the promise_test in transition cancel tests. r=birtles
MozReview-Commit-ID: 7cXfwkT7kaH --HG-- extra : rebase_source : c19372eb265fbc9d0869ac8a9ae41e05f789d5ce
This commit is contained in:
parent
01468c06af
commit
4bb206baf4
@ -5,7 +5,7 @@
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
async_test(function(t) {
|
||||
promise_test(function(t) {
|
||||
var div = addDiv(t, { style: 'margin-left: 0px' });
|
||||
flushComputedStyle(div);
|
||||
|
||||
@ -14,17 +14,16 @@ async_test(function(t) {
|
||||
flushComputedStyle(div);
|
||||
|
||||
var animation = div.getAnimations()[0];
|
||||
animation.ready.then(waitForFrame).then(t.step_func(function() {
|
||||
return animation.ready.then(waitForFrame).then(function() {
|
||||
assert_not_equals(getComputedStyle(div).marginLeft, '1000px',
|
||||
'transform style is animated before cancelling');
|
||||
animation.cancel();
|
||||
assert_equals(getComputedStyle(div).marginLeft, div.style.marginLeft,
|
||||
'transform style is no longer animated after cancelling');
|
||||
t.done();
|
||||
}));
|
||||
});
|
||||
}, 'Animated style is cleared after cancelling a running CSS transition');
|
||||
|
||||
async_test(function(t) {
|
||||
promise_test(function(t) {
|
||||
var div = addDiv(t, { style: 'margin-left: 0px' });
|
||||
flushComputedStyle(div);
|
||||
|
||||
@ -32,24 +31,22 @@ async_test(function(t) {
|
||||
div.style.marginLeft = '1000px';
|
||||
flushComputedStyle(div);
|
||||
|
||||
div.addEventListener('transitionend', t.step_func(function() {
|
||||
div.addEventListener('transitionend', function() {
|
||||
assert_unreached('Got unexpected end event on cancelled transition');
|
||||
}));
|
||||
});
|
||||
|
||||
var animation = div.getAnimations()[0];
|
||||
animation.ready.then(t.step_func(function() {
|
||||
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);
|
||||
})).then(t.step_func(function() {
|
||||
t.done();
|
||||
}));
|
||||
});
|
||||
}, 'Cancelled CSS transitions do not dispatch events');
|
||||
|
||||
async_test(function(t) {
|
||||
promise_test(function(t) {
|
||||
var div = addDiv(t, { style: 'margin-left: 0px' });
|
||||
flushComputedStyle(div);
|
||||
|
||||
@ -58,7 +55,7 @@ async_test(function(t) {
|
||||
flushComputedStyle(div);
|
||||
|
||||
var animation = div.getAnimations()[0];
|
||||
animation.ready.then(t.step_func(function() {
|
||||
return animation.ready.then(function() {
|
||||
animation.cancel();
|
||||
assert_equals(getComputedStyle(div).marginLeft, '1000px',
|
||||
'margin-left style is not animated after cancelling');
|
||||
@ -66,14 +63,13 @@ async_test(function(t) {
|
||||
assert_equals(getComputedStyle(div).marginLeft, '0px',
|
||||
'margin-left style is animated after re-starting transition');
|
||||
return animation.ready;
|
||||
})).then(t.step_func(function() {
|
||||
}).then(function() {
|
||||
assert_equals(animation.playState, 'running',
|
||||
'Transition succeeds in running after being re-started');
|
||||
t.done();
|
||||
}));
|
||||
});
|
||||
}, 'After cancelling a transition, it can still be re-used');
|
||||
|
||||
async_test(function(t) {
|
||||
promise_test(function(t) {
|
||||
var div = addDiv(t, { style: 'margin-left: 0px' });
|
||||
flushComputedStyle(div);
|
||||
|
||||
@ -82,7 +78,7 @@ async_test(function(t) {
|
||||
flushComputedStyle(div);
|
||||
|
||||
var animation = div.getAnimations()[0];
|
||||
animation.ready.then(t.step_func(function() {
|
||||
return animation.ready.then(function() {
|
||||
animation.finish();
|
||||
animation.cancel();
|
||||
assert_equals(getComputedStyle(div).marginLeft, '1000px',
|
||||
@ -91,11 +87,10 @@ async_test(function(t) {
|
||||
assert_equals(getComputedStyle(div).marginLeft, '0px',
|
||||
'margin-left style is animated after re-starting transition');
|
||||
return animation.ready;
|
||||
})).then(t.step_func(function() {
|
||||
}).then(function() {
|
||||
assert_equals(animation.playState, 'running',
|
||||
'Transition succeeds in running after being re-started');
|
||||
t.done();
|
||||
}));
|
||||
});
|
||||
}, 'After cancelling a finished transition, it can still be re-used');
|
||||
|
||||
test(function(t) {
|
||||
|
Loading…
Reference in New Issue
Block a user