From c16068ca85421c028213c650aee04e6e80106007 Mon Sep 17 00:00:00 2001 From: kkapsner Date: Mon, 2 Nov 2020 13:07:40 +0100 Subject: [PATCH] domRectTest: update SVG tests --- test/domRectTest.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/domRectTest.js b/test/domRectTest.js index fd7b431..8e56ac9 100644 --- a/test/domRectTest.js +++ b/test/domRectTest.js @@ -191,13 +191,24 @@ return element.getBBox(); }, "svg"); createTest("SVGTextContentElement.getExtentOfChar", function(element){ - return element.getExtentOfChar(element.textContent.length - 1); + return element.getEndPositionOfChar? element.getExtentOfChar(element.textContent.length - 1): null; }, "svg"); createTest("SVGTextContentElement.get(Start|End)OfChar", function(element){ + if (!element.getStartPositionOfChar){ + return null; + } const start = element.getStartPositionOfChar(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); }, "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){ parentNode.querySelector(".toggle").addEventListener("click", function(){