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
This commit is contained in:
crschmidt
2007-12-18 16:52:06 +00:00
parent 546d49fc34
commit d9230297ec

View File

@@ -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 @@
</head>
<body>
</body>
</html>
</html>