blob: 8a1814c6678cf2aecad43597a2d39968372d7b6d [file] [log] [blame]
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
'use strict';
// From UseCounter.h
var WebAnimationsEasingAsFunctionLinear = 1295;
var WebAnimationsEasingAsFunctionOther = 1296;
test(() => {
document.documentElement.animate([], { });
document.documentElement.animate([], { easing: 'linear' });
document.documentElement.animate([], { easing: 'step-start' });
assert_false(internals.isUseCounted(document, WebAnimationsEasingAsFunctionLinear));
assert_false(internals.isUseCounted(document, WebAnimationsEasingAsFunctionOther));
}, 'Non-function values for easing are not use-counted.');
test(() => {
assert_throws(
{name: 'TypeError'},
function() { document.documentElement.animate([], { easing: 'invalid' }) });
assert_false(internals.isUseCounted(document, WebAnimationsEasingAsFunctionLinear));
assert_false(internals.isUseCounted(document, WebAnimationsEasingAsFunctionOther));
}, 'Invalid non-function values for easing are not use-counted.');
test(() => {
// This linear function value is the one expected from uses of the unpatched
// Web Animations polyfill (i.e. old versions lacking
// https://github.com/web-animations/web-animations-next/pull/423).
assert_throws(
{name: 'TypeError'},
function() { document.documentElement.animate([], { easing: 'function (a){return a}' }) });
assert_true(internals.isUseCounted(document, WebAnimationsEasingAsFunctionLinear));
assert_false(internals.isUseCounted(document, WebAnimationsEasingAsFunctionOther));
}, 'A specific linear function for easing is counted in WebAnimationsEasingAsFunctionLinear.');
</script>