1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +01:00

domRectTest: update SVG tests

This commit is contained in:
kkapsner 2020-11-02 13:07:40 +01:00
parent ef69e1dcb5
commit c16068ca85

View File

@ -191,13 +191,24 @@
return element.getBBox(); return element.getBBox();
}, "svg"); }, "svg");
createTest("SVGTextContentElement.getExtentOfChar", function(element){ createTest("SVGTextContentElement.getExtentOfChar", function(element){
return element.getExtentOfChar(element.textContent.length - 1); return element.getEndPositionOfChar? element.getExtentOfChar(element.textContent.length - 1): null;
}, "svg"); }, "svg");
createTest("SVGTextContentElement.get(Start|End)OfChar", function(element){ createTest("SVGTextContentElement.get(Start|End)OfChar", function(element){
if (!element.getStartPositionOfChar){
return null;
}
const start = element.getStartPositionOfChar(element.textContent.length - 1); const start = element.getStartPositionOfChar(element.textContent.length - 1);
const end = element.getEndPositionOfChar(element.textContent.length - 1); const end = element.getEndPositionOfChar(element.textContent.length - 1);
return new DOMRect(start.x, start.y, end.x - start.x, end.y - start.y); return new DOMRect(start.x, start.y, end.x - start.x, end.y - start.y);
}, "svg"); }, "svg");
createTest("SVGGeometryElement.getPointAtLength", function(element){
if (!element.getPointAtLength){
return null;
}
const start = element.getPointAtLength(Math.E);
const end = element.getPointAtLength(Math.PI);
return new DOMRect(start.x, start.y, end.x - start.x, end.y - start.y);
}, "svg");
document.querySelectorAll(".content-hidable").forEach(function(parentNode){ document.querySelectorAll(".content-hidable").forEach(function(parentNode){
parentNode.querySelector(".toggle").addEventListener("click", function(){ parentNode.querySelector(".toggle").addEventListener("click", function(){