diff --git a/src/ol/parser/ogc/wfsparser_v1_1_0.js b/src/ol/parser/ogc/wfsparser_v1_1_0.js index b17488b1d7..02452be120 100644 --- a/src/ol/parser/ogc/wfsparser_v1_1_0.js +++ b/src/ol/parser/ogc/wfsparser_v1_1_0.js @@ -54,7 +54,9 @@ ol.parser.ogc.WFS_v1_1_0 = function() { var options = obj.options; var node = obj.node; if (goog.isDef(options)) { - node.setAttribute('resultType', options.resultType); + if (goog.isDef(options.resultType)) { + node.setAttribute('resultType', options.resultType); + } if (goog.isDef(options.startIndex)) { node.setAttribute('startIndex', options.startIndex); } diff --git a/test/spec/ol/parser/ogc/wfs_v1_1_0.test.js b/test/spec/ol/parser/ogc/wfs_v1_1_0.test.js index c92d02eeea..1e24d2ccbc 100644 --- a/test/spec/ol/parser/ogc/wfs_v1_1_0.test.js +++ b/test/spec/ol/parser/ogc/wfs_v1_1_0.test.js @@ -71,7 +71,7 @@ describe('ol.parser.ogc.WFS_v1_1_0', function() { }); - it('handles writing GetFeature with PropertyName', function(done) { + it('handles writing GetFeature with resultType hits', function(done) { var url = 'spec/ol/parser/ogc/xml/wfs_v1_1_0/getfeature0.xml'; afterLoadXml(url, function(xml) { var p = new ol.parser.ogc.WFS_v1_1_0(); @@ -91,6 +91,24 @@ describe('ol.parser.ogc.WFS_v1_1_0', function() { }); }); + it('handles writing GetFeature with paging info', function(done) { + var url = 'spec/ol/parser/ogc/xml/wfs_v1_1_0/getfeature1.xml'; + afterLoadXml(url, function(xml) { + var p = new ol.parser.ogc.WFS_v1_1_0(); + var output = p.writers[p.defaultNamespaceURI]['GetFeature'].apply( + p, [{ + count: 10, + startIndex: 20, + srsName: 'urn:ogc:def:crs:EPSG::4326', + featureNS: 'http://www.openplans.org/topp', + featurePrefix: 'topp', + featureTypes: ['states'] + }]); + expect(goog.dom.xml.loadXml(p.serialize(output))).to.xmleql(xml); + done(); + }); + }); + }); }); diff --git a/test/spec/ol/parser/ogc/xml/wfs_v1_1_0/getfeature1.xml b/test/spec/ol/parser/ogc/xml/wfs_v1_1_0/getfeature1.xml new file mode 100644 index 0000000000..f79e579d08 --- /dev/null +++ b/test/spec/ol/parser/ogc/xml/wfs_v1_1_0/getfeature1.xml @@ -0,0 +1,8 @@ + + + +