test_SVGNumberList.xhtml (1836B)
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <!-- 3 https://bugzilla.mozilla.org/show_bug.cgi?id=629200 4 --> 5 <head> 6 <title>Tests specific to SVGNumberList</title> 7 <script src="/tests/SimpleTest/SimpleTest.js"></script> 8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 9 </head> 10 <body> 11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=629200">Mozilla Bug 629200</a> 12 <p id="display"></p> 13 <div id="content" style="display:none;"> 14 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="100" height="100"> 15 <text id="text" rotate="10 20 30">abc</text> 16 </svg> 17 </div> 18 <pre id="test"> 19 <script class="testbody" type="text/javascript"> 20 <![CDATA[ 21 22 SimpleTest.waitForExplicitFinish(); 23 24 /* 25 This file runs a series of SVGNumberList specific tests. Generic SVGXxxList 26 tests can be found in test_SVGxxxList.xhtml. Anything that can be generalized 27 to other list types belongs there. 28 */ 29 30 function run_tests() { 31 document.getElementById("svg").pauseAnimations(); 32 33 var text = document.getElementById("text"); 34 var numbers = text.rotate.baseVal; 35 36 is(numbers.numberOfItems, 3, "Checking numberOfItems"); 37 38 // Test mutation events 39 // -- Actual changes 40 numbers[0].value = 15; 41 text.setAttribute("rotate", "17 20 30"); 42 // -- Redundant changes 43 numbers[0].value = 17; 44 numbers[1].value = 20; 45 text.setAttribute("rotate", "17 20 30"); 46 // -- Invalid attribute 47 text.setAttribute("rotate", ",20"); 48 is(numbers.numberOfItems, 0, "Checking that parsing stops at invalid token"); 49 // -- Attribute removal 50 text.removeAttribute("rotate"); 51 // -- Non-existent attribute removal 52 text.removeAttribute("rotate"); 53 text.removeAttributeNS(null, "rotate"); 54 55 SimpleTest.finish(); 56 } 57 58 window.addEventListener("load", 59 () => SimpleTest.executeSoon(run_tests) 60 ); 61 62 ]]> 63 </script> 64 </pre> 65 </body> 66 </html>