| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../resources/js-test.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 <p id="description"></p> | |
| 8 <div id="console"></div> | |
| 9 <script> | |
| 10 description("Tests that insertItemBefore correctly appends if its index is o
ut of bounds."); | |
| 11 var path = document.createElementNS("http://www.w3.org/2000/svg","path"); | |
| 12 var seg00 = path.createSVGPathSegMovetoAbs(0,0); | |
| 13 var seg01 = path.createSVGPathSegMovetoAbs(0,1); | |
| 14 var seg11 = path.createSVGPathSegMovetoAbs(1,1); | |
| 15 var seg10 = path.createSVGPathSegMovetoAbs(1,0); | |
| 16 var svgList = path.pathSegList; | |
| 17 shouldBe("svgList.numberOfItems", "0"); | |
| 18 svgList.appendItem(seg01); | |
| 19 shouldBe("svgList.numberOfItems", "1"); | |
| 20 shouldBe("svgList.getItem(0)", "seg01"); | |
| 21 svgList.appendItem(seg11); | |
| 22 shouldBe("svgList.numberOfItems", "2"); | |
| 23 shouldBe("svgList.getItem(0)", "seg01"); | |
| 24 shouldBe("svgList.getItem(1)", "seg11"); | |
| 25 svgList.insertItemBefore(seg00, 0); | |
| 26 shouldBe("svgList.numberOfItems", "3"); | |
| 27 shouldBe("svgList.getItem(0)", "seg00"); | |
| 28 shouldBe("svgList.getItem(1)", "seg01"); | |
| 29 shouldBe("svgList.getItem(2)", "seg11"); | |
| 30 svgList.insertItemBefore(seg10, 42); | |
| 31 shouldBe("svgList.numberOfItems", "4"); | |
| 32 shouldBe("svgList.getItem(0)", "seg00"); | |
| 33 shouldBe("svgList.getItem(1)", "seg01"); | |
| 34 shouldBe("svgList.getItem(2)", "seg11"); | |
| 35 shouldBe("svgList.getItem(3)", "seg10"); | |
| 36 </script> | |
| 37 </body> | |
| 38 </html> | |
| OLD | NEW |