From d9230297ec0bd91ad8316bdb8e51827468fdb7d2 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Tue, 18 Dec 2007 16:52:06 +0000 Subject: [PATCH] Change test to use importNode if available, and add a test for serializing a node as well as a geometry. (The latter test will fail in FF3 until #1219 is fixed.) git-svn-id: http://svn.openlayers.org/trunk/openlayers@5498 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- tests/Format/test_XML.html | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/Format/test_XML.html b/tests/Format/test_XML.html index aded57e4d6..80a5419fce 100644 --- a/tests/Format/test_XML.html +++ b/tests/Format/test_XML.html @@ -71,7 +71,7 @@ } function test_Format_XML_write(t) { - t.plan(1); + t.plan(2); var format = new OpenLayers.Format.XML(); var doc = format.read(text); @@ -81,6 +81,13 @@ var expected = text.replace(/<\?.*\?>/, '') t.eq(expected, out, "correctly writes an XML DOM doc"); + + var out = format.write(doc.firstChild); + out = out.replace(/[\r\n]/g, ''); + out = out.replace( /<\?.*\?>/, '') + var expected = text.replace(/<\?.*\?>/, '') + t.eq(expected, out, + "correctly writes an XML DOM node"); } function test_Format_XML_createElementNS(t) { @@ -102,6 +109,9 @@ "node has correct namespace uri"); var doc = format.read(text); + if (doc.importNode) { + node = doc.importNode(node, true); + } t.ok(doc.documentElement.appendChild(node), "node can be appended to a doc root"); } @@ -120,6 +130,9 @@ "node has correct value"); var doc = format.read(text); + if (doc.importNode) { + node = doc.importNode(node, true); + } t.ok(doc.documentElement.appendChild(node), "node can be appended to a doc root"); } @@ -222,4 +235,4 @@ - \ No newline at end of file +