Skip to content

Commit

Permalink
Merge pull request web-platform-tests#12 from alancutter/localTime
Browse files Browse the repository at this point in the history
Upstream effect-of-keyframeeffect-on-getComputedTiming.html from Blink
  • Loading branch information
suzyh authored Jul 18, 2016
2 parents fe8635f + 74045a0 commit 5b55e54
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 11 deletions.
13 changes: 13 additions & 0 deletions web-animations/interfaces/AnimationEffectTiming/delay.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,18 @@
assert_equals(anim.effect.getComputedTiming().currentIteration, 0);
}, 'Test finishing an animation using a large negative delay');

test(function(t) {
var div = createDiv(t);
var anim = div.animate(null);
for (let invalid of [NaN, Infinity]) {
assert_throws({ name: 'TypeError' }, function() {
anim.effect.timing.delay = invalid;
}, 'setting ' + invalid);
assert_throws({ name: 'TypeError' }, function() {
div.animate({}, { delay: invalid });
}, 'animate() with ' + invalid);
}
}, 'Setting invalid values should throw TypeError');

</script>
</body>
21 changes: 10 additions & 11 deletions web-animations/interfaces/AnimationEffectTiming/iterationStart.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,16 @@

test(function(t) {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 100);
assert_throws({ name: 'TypeError' },
function() {
anim.effect.timing.iterationStart = -1;
});
assert_throws({ name: 'TypeError' },
function() {
div.animate({ opacity: [ 0, 1 ] },
{ iterationStart: -1 });
});
}, 'Test invalid iterationStart value');
var anim = div.animate(null);
for (let invalid of [-1, NaN, Infinity]) {
assert_throws({ name: 'TypeError' }, function() {
anim.effect.timing.iterationStart = invalid;
}, 'setting ' + invalid);
assert_throws({ name: 'TypeError' }, function() {
div.animate({}, { iterationStart: invalid });
}, 'animate() with ' + invalid);
}
}, 'Using invalid values should throw TypeError');

</script>
</body>
26 changes: 26 additions & 0 deletions web-animations/timing-model/animation-effects/local-time.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>AnimationEffect local time tests</title>
<link rel="help" href="http://w3c.github.io/web-animations/#local-time">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<script>
'use strict';

test(function(t) {
var anim = createDiv(t).animate(null, 10 * MS_PER_SEC);
for (var seconds of [-1, 0, 5, 10, 20]) {
anim.currentTime = seconds * MS_PER_SEC;
assert_equals(anim.effect.getComputedTiming().localTime, seconds * MS_PER_SEC);
}
}, 'Local time is current time for animation effects associated with an animation.');

test(function(t) {
var effect = new KeyframeEffect(createDiv(t), null, 10 * MS_PER_SEC);
assert_equals(effect.getComputedTiming().localTime, null);
}, 'Local time is unresolved for animation effects not associated with an animation.');

</script>
</body>

0 comments on commit 5b55e54

Please sign in to comment.