From a9494394da097ecd4c5032af4c28a44c83ef6854 Mon Sep 17 00:00:00 2001 From: Matt Walker Date: Mon, 15 Oct 2012 11:09:52 +0100 Subject: [PATCH] Comparing the filter XML written using t.xml_eq. The PropertyIsNull test now used the t.xml_eq method to verify the XML output when the filter is written. Tided up variable names to be consistent with other tests. --- tests/Format/Filter/v1.html | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/tests/Format/Filter/v1.html b/tests/Format/Filter/v1.html index 7a5230a1bb..fcf5c67044 100644 --- a/tests/Format/Filter/v1.html +++ b/tests/Format/Filter/v1.html @@ -53,15 +53,12 @@ function test_PropertyIsNull(t) { - t.plan(6); + t.plan(3); - var test_xml, format, xml, filter; + var format, test_xml, xml, filter; format = new OpenLayers.Format.Filter.v1(); - // Test reading a PropertyIsNull filter from an XML doc - xml = new OpenLayers.Format.XML(); - test_xml = '' + '' + @@ -69,6 +66,8 @@ '' + ''; + // Test reading a PropertyIsNull filter from an XML doc + xml = new OpenLayers.Format.XML(); filter = format.read(xml.read(test_xml).documentElement); t.eq(filter.type, OpenLayers.Filter.Comparison.IS_NULL, "[0] read correct type"); @@ -80,15 +79,8 @@ type: OpenLayers.Filter.Comparison.IS_NULL, property: "prop" }); - var element = format.write(filter); - t.eq(element.firstChild.nodeName, 'ogc:PropertyIsNull', - "[1] write correct filter node name"); - t.eq(element.firstChild.childNodes.length, 1, - "[1] write correct number of filter arguments"); - t.eq(element.firstChild.firstChild.nodeName, 'ogc:PropertyName', - "[1] write correct filter argument name"); - t.eq(element.firstChild.firstChild.textContent, 'prop', - "[1] write correct filter argument value"); + var node = format.write(filter); + t.xml_eq(node, test_xml, "filter correctly written"); }