servo/tests/wpt/web-platform-tests/web-animations/timing-model/animation-effects/local-time.html

26 lines
938 B
HTML

<!DOCTYPE html>
<meta charset=utf-8>
<title>AnimationEffect local time tests</title>
<link rel="help" href="https://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>