test_SVGPathSegment.xhtml (1202B)
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <!-- 3 https://bugzilla.mozilla.org/show_bug.cgi?id=1954044 4 --> 5 <head> 6 <title>Tests for SVG path.setPathData</title> 7 <script type="text/javascript" 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=1954044">Mozilla Bug 1954044</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 <path id="path"/> 16 </svg> 17 </div> 18 <pre id="test"> 19 <script class="testbody" type="text/javascript"> 20 <![CDATA[ 21 22 SimpleTest.waitForExplicitFinish(); 23 24 function run_tests() 25 { 26 let path = document.getElementById("path"); 27 28 // See https://github.com/w3c/editing/issues/483 29 path.setPathData([{"type":"M","values":[0,0]},{"type":"L","values":[100,100]}]); 30 is(path.getAttribute("d"), "M 0 0 L 100 100"); 31 32 path.setPathData([{"type":"M","values":[0,0]},{"type":"Z","values":[]}]); 33 is(path.getAttribute("d"), "M 0 0 Z"); 34 35 SimpleTest.finish(); 36 } 37 38 window.addEventListener("load", run_tests); 39 40 ]]> 41 </script> 42 </pre> 43 </body> 44 </html>