Bug 1178186 part 2 - Add tests for CSSAnimation and CSSTransition interfaces; r=jwatt

--HG--
extra : commitid : HPBvU8HtFyk
extra : rebase_source : 438b23a4009675d000aaa9ff74334ad5d341831a
This commit is contained in:
Brian Birtles 2015-06-30 10:00:56 +09:00
parent e298fe6b44
commit 0aa6deec0b
3 changed files with 26 additions and 7 deletions

View File

@ -27,6 +27,8 @@ test(function(t) {
async_test(function(t) {
var div = addDiv(t);
// FIXME: This test does too many things. It should be split up.
// Add an animation
div.style.animation = 'anim1 100s';
var animations = div.getAnimations();
@ -60,6 +62,12 @@ async_test(function(t) {
}));
}, 'getAnimations for CSS Animations');
test(function(t) {
var div = addDiv(t, { style: 'animation: anim1 100s' });
assert_class_string(div.getAnimations()[0], 'CSSAnimation',
'Interface of returned animation is CSSAnimation');
}, 'getAnimations returns CSSAnimation objects for CSS Animations');
test(function(t) {
var div = addDiv(t);
@ -88,14 +96,13 @@ async_test(function(t) {
assert_equals(animations.length, 2,
'getAnimations returns Animations for both animations and'
+ ' transitions that run simultaneously');
return waitForAllAnimations(animations);
})).then(t.step_func(function() {
assert_true(animations[0].startTime > animations[1].startTime,
'Animations for transitions appear before animations even if they'
+ ' start later');
assert_class_string(animations[0], 'CSSTransition',
'First-returned animation is the CSS Transition');
assert_class_string(animations[1], 'CSSAnimation',
'Second-returned animation is the CSS Animation');
t.done();
}));
}, 'getAnimations for both CSS Animations and Transitions at once');
}, 'getAnimations for both CSS Animations and CSS Transitions at once');
async_test(function(t) {
var div = addDiv(t);

View File

@ -8,6 +8,8 @@
async_test(function(t) {
var div = addDiv(t);
// FIXME: This test does too many things. It should be split up.
// Add a couple of transitions
div.style.left = '0px';
div.style.top = '0px';
@ -42,6 +44,16 @@ async_test(function(t) {
}));
}, 'getAnimations for CSS Transitions');
test(function(t) {
var div = addDiv(t, { style: 'left: 0px; transition: all 100s' });
flushComputedStyle(div);
div.style.left = '100px';
assert_class_string(div.getAnimations()[0], 'CSSTransition',
'Interface of returned animation is CSSTransition');
}, 'getAnimations returns CSSTransition objects for CSS Transitions');
async_test(function(t) {
var div = addDiv(t);

View File

@ -80,7 +80,7 @@ function flushComputedStyle(elem) {
for (var funcName of ["async_test", "assert_not_equals", "assert_equals",
"assert_approx_equals", "assert_less_than_equal",
"assert_between_inclusive", "assert_true", "assert_false",
"assert_throws", "test"]) {
"assert_class_string", "assert_throws", "test"]) {
window[funcName] = opener[funcName].bind(opener);
}