test_smilAccessKey.xhtml (2140B)
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <head> 3 <title>Test for SMIL accessKey support</title> 4 <script src="/tests/SimpleTest/SimpleTest.js"></script> 5 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 6 </head> 7 <body> 8 <a target="_blank" 9 href="https://bugzilla.mozilla.org/show_bug.cgi?id=587910">Mozilla Bug 10 587910</a> 11 <p id="display"></p> 12 <div id="content" style="display: none"> 13 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px"> 14 <circle cx="20" cy="20" r="15" fill="blue" id="circle"/> 15 </svg> 16 </div> 17 <pre id="test"> 18 <script class="testbody" type="text/javascript"> 19 <![CDATA[ 20 /** Test for lack of SMIL accessKey support */ 21 22 const gSvgns = 'http://www.w3.org/2000/svg'; 23 SimpleTest.waitForExplicitFinish(); 24 25 function main() 26 { 27 testBeginValueIsNotSupported('accessKey(a)'); 28 testBeginValueIsNotSupported('accesskey(a)'); 29 30 is(getStartTime('accesskey(a); 1s'), 1, 31 'Start time for accesskey(a) followed by a literal time'); 32 is(getStartTime('3s; accessKey(a)'), 3, 33 'Start time for accesskey(a) preceded by a literal time'); 34 35 SimpleTest.finish(); 36 } 37 38 function createAnim(beginSpec) { 39 const anim = document.createElementNS(gSvgns, 'animate'); 40 anim.setAttribute('attributeName', 'cx'); 41 anim.setAttribute('values', '0; 100'); 42 anim.setAttribute('dur', '10s'); 43 anim.setAttribute('begin', beginSpec); 44 return document.getElementById('circle').appendChild(anim); 45 } 46 47 function testBeginValueIsNotSupported(beginSpec) { 48 const anim = createAnim(beginSpec); 49 50 try { 51 anim.getStartTime(); 52 ok(false, 53 `Should have failed to get start time for begin value: ${beginSpec}`); 54 } catch(e) { 55 is(e.name, 'InvalidStateError', `Unexpected exception: ${e.name}`); 56 is(e.code, DOMException.INVALID_STATE_ERR, 57 `Unexpected exception code: ${e.code}`); 58 } 59 60 anim.remove(); 61 } 62 63 function getStartTime(beginSpec) { 64 const anim = createAnim(beginSpec); 65 let startTime; 66 try { 67 startTime = anim.getStartTime(); 68 } catch (e) { } 69 anim.remove(); 70 71 return startTime; 72 } 73 74 window.addEventListener('load', main); 75 ]]> 76 </script> 77 </pre> 78 </body> 79 </html>