Port over test case for multiple Query elements

This commit is contained in:
Bart van den Eijnden
2014-03-10 15:37:29 +01:00
parent 33abbfced1
commit 6800a3290b
3 changed files with 25 additions and 2 deletions
+3 -1
View File
@@ -442,7 +442,9 @@ ol.format.WFS.writeQuery_ = function(node, featureType, objectStack) {
var srsName = goog.object.get(context, 'srsName'); var srsName = goog.object.get(context, 'srsName');
var prefix = goog.isDef(featurePrefix) ? featurePrefix + ':' : ''; var prefix = goog.isDef(featurePrefix) ? featurePrefix + ':' : '';
node.setAttribute('typeName', prefix + featureType); node.setAttribute('typeName', prefix + featureType);
node.setAttribute('srsName', srsName); if (goog.isDef(srsName)) {
node.setAttribute('srsName', srsName);
}
if (goog.isDef(featureNS)) { if (goog.isDef(featureNS)) {
node.setAttribute('xmlns:' + featurePrefix, featureNS); node.setAttribute('xmlns:' + featurePrefix, featureNS);
} }
@@ -1,4 +1,4 @@
<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wfs:Query typeName="topp:states" xmlns:topp="http://www.openplans.org/topp"/> <wfs:Query typeName="topp:states" xmlns:topp="http://www.openplans.org/topp"/>
<wfs:Query typeName="topp:cities" xmlns:topp="http://www.openplans.org/topp"/> <wfs:Query typeName="topp:cities" xmlns:topp="http://www.openplans.org/topp"/>
</wfs:GetFeature> </wfs:GetFeature>
+21
View File
@@ -259,6 +259,27 @@ describe('ol.format.WFS', function() {
expect(serialized).to.xmleql(ol.xml.load(text)); expect(serialized).to.xmleql(ol.xml.load(text));
}); });
}); });
describe('when writing out a GetFeature request', function() {
var text;
before(function(done) {
afterLoadText('spec/ol/format/wfs/GetFeatureMultiple.xml', function(xml) {
text = xml;
done();
});
});
it('handles writing multiple Query elements', function() {
var format = new ol.format.WFS();
var serialized = format.writeGetFeature({
featureNS: 'http://www.openplans.org/topp',
featureTypes: ['states', 'cities'],
featurePrefix: 'topp'
});
expect(serialized).to.xmleql(ol.xml.load(text));
});
});
}); });