blob: ef3962d4add57d82ce8628062b03f176c51c73a9 [file] [log] [blame]
<!doctype html>
<meta charset=utf-8>
<title>Animation.frameRate</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../imported/w3c/web-platform-tests/web-animations/testcommon.js"></script>
<body>
<script>
'use strict';
test(t => {
const animation = new Animation;
assert_equals(animation.frameRate, "auto", "The default value for frameRate is 'auto'");
// AnimationFrameRatePreset values.
for (let value of ["low", "high", "highest", "auto"]) {
animation.frameRate = value;
assert_equals(animation.frameRate, value, `The value "${value}" can be set`);
}
// Numeric value.
animation.frameRate = 60;
assert_equals(animation.frameRate, 60, `A numeric value can be set`);
}, "Valid animation.frameRate values");
test(t => {
const animation = new Animation;
for (let value of ["default", "120", null, undefined, [], {}]) {
assert_throws(new TypeError, () => animation.frameRate = value, `Setting the value ${value} throws`);
assert_equals(animation.frameRate, "auto", `Setting the invalid value "${value}" does not change the value`);
}
}, "Invalid animation.frameRate values");
</script>
</body>