tenfourfox/dom/animation/test/css-transitions/file_timeline-get-animations.html
Cameron Kaiser c9b2922b70 hello FPR
2017-04-19 00:56:45 -07:00

51 lines
1.4 KiB
HTML

<!doctype html>
<meta charset=utf-8>
<script src="../testcommon.js"></script>
<body>
<script>
'use strict';
test(function(t) {
assert_equals(document.timeline.getAnimations().length, 0,
'getAnimations returns an empty sequence for a document'
+ ' with no animations');
}, 'getAnimations for non-animated content');
test(function(t) {
var div = addDiv(t);
// Add a couple of transitions
div.style.left = '0px';
div.style.top = '0px';
getComputedStyle(div).transitionProperty;
div.style.transition = 'all 100s';
div.style.left = '100px';
div.style.top = '100px';
assert_equals(document.timeline.getAnimations().length, 2,
'getAnimations returns two running CSS Transitions');
// Remove both
div.style.transitionProperty = 'none';
assert_equals(document.timeline.getAnimations().length, 0,
'getAnimations returns no running CSS Transitions');
}, 'getAnimations for CSS Transitions');
async_test(function(t) {
var div = addDiv(t, { style: 'left: 0px; transition: all 50ms' });
flushComputedStyle(div);
div.style.left = '100px';
var animations = div.getAnimations();
assert_equals(animations.length, 1, 'Got transition');
animations[0].finished.then(t.step_func(function() {
assert_equals(document.timeline.getAnimations().length, 0,
'No animations returned');
t.done();
}));
}, 'Transitions are not returned after they have finished');
done();
</script>
</body>