keyframe-exceptions.html (1037B)
1 <!DOCTYPE html> 2 <head> 3 <meta charset="utf-8"> 4 <link rel="help" src="https://www.w3.org/TR/web-animations-1/#processing-a-keyframes-argument"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/web-animations/testcommon.js"></script> 8 <script src="support/testcommon.js"></script> 9 <title>Keyframes with invalid offsets</title> 10 </head> 11 <script> 12 test(() => { 13 assert_throws_js(TypeError, 14 function() { 15 document.documentElement.animate([ 16 {offset: 0.6}, 17 {offset: 0.4} 18 ]); 19 }); 20 }, 'Offsets must be loosely sorted'); 21 22 test(() => { 23 assert_throws_js(TypeError, 24 function() { 25 document.documentElement.animate([ 26 {offset: 'whatever'} 27 ]); 28 }); 29 }, 'Invalid offset'); 30 31 test(() => { 32 assert_throws_js(TypeError, 33 function() { 34 document.documentElement.animate([ 35 {offset: -1} 36 ]); 37 }); 38 }, 'Offsets must be null or in the range [0,1]'); 39 </script>