From 24aaa973d76712706ea25852033a1d918b309149 Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Sun, 21 Feb 2010 18:28:10 +0000 Subject: [PATCH] Add first test for importing SVG into an existing drawing git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1424 eee81c28-f429-11dd-99c0-75d572ba1ddd --- test/test1.html | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/test/test1.html b/test/test1.html index b29589d2..5631971c 100644 --- a/test/test1.html +++ b/test/test1.html @@ -218,7 +218,32 @@ equals(svgCanvas.getPrivateMethods().toXml(">"), ">", "Escaped > properly"); equals(svgCanvas.getPrivateMethods().toXml("&"), "&", "Escaped & properly"); // TODO: what about " and ' ? - }); + }); + + test("Test importing SVG into existing drawing", function() { + expect(3); + + var doc = svgCanvas.setSvgString(''+ + 'Layer 1'+ + ''+ + ''+ + ''+ + ''); + + svgCanvas.importSvgString(''+ + ''+ + ''+ + ''); + + var svgcontent = document.getElementById("svgcontent"), + circles = svgcontent.getElementsByTagNameNS(svgns, "circle"), + rects = svgcontent.getElementsByTagNameNS(svgns, "rect"), + ellipses = svgcontent.getElementsByTagNameNS(svgns, "ellipse"); + equals(circles.length, 2, "Found two circles upon importing"); + equals(rects.length, 1, "Found one rectangle upon importing"); + equals(ellipses.length, 1, "Found one ellipse upon importing"); + }); + });