Enable parsing complex features

This commit is contained in:
Niels Charlier
2018-10-15 14:43:36 +02:00
committed by Frederic Junod
parent 2005c82dd2
commit 594a921598
3 changed files with 214 additions and 24 deletions

View File

@@ -1601,6 +1601,41 @@ describe('ol.format.GML3', function() {
});
describe('when parsing complex', function() {
let features, gmlFormat;
before(function(done) {
afterLoadText('spec/ol/format/gml/gml-complex.xml', function(xml) {
try {
gmlFormat = new GML();
features = gmlFormat.readFeatures(xml);
} catch (e) {
done(e);
}
done();
});
});
it('creates 3 features', function() {
expect(features).to.have.length(3);
});
it('creates feature with two names', function() {
expect(features[0].values_['name']).to.have.length(2);
});
it('creates nested property', function() {
expect(features[0].values_['observationMethod']['CGI_TermValue']['value']['_content_'])
.to.eql('urn:ogc:def:nil:OGC:missing');
});
it('creates nested attribute', function() {
expect(features[0].values_['observationMethod']['CGI_TermValue']['value']['codeSpace'])
.to.eql('urn:ietf:rfc:2141');
});
});
});