diff --git a/test/browser/spec/ol/format/gml.test.js b/test/browser/spec/ol/format/gml.test.js
index 5aea37a7ea..3c28d0c46e 100644
--- a/test/browser/spec/ol/format/gml.test.js
+++ b/test/browser/spec/ol/format/gml.test.js
@@ -1840,6 +1840,10 @@ describe('ol.format.GML3', function () {
expect(features[0].values_['name']).to.have.length(2);
});
+ it('parses mutliple simple elements to strings', function () {
+ expect(features[0].values_['name'][0]).to.be.a('string');
+ });
+
it('creates nested property', function () {
expect(
features[0].values_['observationMethod']['CGI_TermValue']['value'][
@@ -2902,4 +2906,49 @@ describe('ol.format.GML32', function () {
expect(features[0].get('cdata')).to.be('b');
});
});
+
+ describe('when parsing multiple complex attributes', function () {
+ let features;
+ let gmlFormat;
+ before(function (done) {
+ afterLoadText('spec/ol/format/gml/gml32-complex.xml', function (xml) {
+ try {
+ gmlFormat = new GML32();
+ features = gmlFormat.readFeatures(xml);
+ } catch (e) {
+ done(e);
+ }
+ done();
+ });
+ });
+
+ it('creates 2 features', function () {
+ expect(features).to.have.length(2);
+ });
+
+ it('creates feature with three attributeA properties and two attributeB properties', function () {
+ expect(features[0].values_['attributeA']).to.have.length(3);
+ expect(features[0].values_['attributeB']).to.have.length(2);
+ });
+
+ it('parses mutliple complex elements to an array of objects', function () {
+ expect(features[0].values_['attributeA'][0]).to.be.a('object');
+ });
+
+ it('correctly structures multiple elements with attributes', function () {
+ expect(features[0].values_['attributeA'][0]['xlink:href']).to.be(
+ 'http://www.example.com/extern/1'
+ );
+ expect(features[0].values_['attributeA'][0]._content_).to.be(undefined);
+ expect(features[0].values_['attributeA'][1]['xlink:href']).to.be(
+ 'http://www.example.com/extern/2'
+ );
+ expect(features[0].values_['attributeA'][2]._content_).to.be(undefined);
+ });
+
+ it('correctly structures multiple elements with complex content', function () {
+ expect(features[0].values_['attributeB'][0].Attribute.value).to.be('foo');
+ expect(features[0].values_['attributeB'][1].Attribute.value).to.be('bar');
+ });
+ });
});
diff --git a/test/browser/spec/ol/format/gml/gml32-complex.xml b/test/browser/spec/ol/format/gml/gml32-complex.xml
new file mode 100644
index 0000000000..5ed7196a8c
--- /dev/null
+++ b/test/browser/spec/ol/format/gml/gml32-complex.xml
@@ -0,0 +1,49 @@
+
+
+
+
+ featureA
+
+
+
+
+
+ foo
+
+
+
+
+ bar
+
+
+
+
+ 0 0
+
+
+
+
+
+
+ featureB
+
+
+
+
+
+ foobar
+
+
+
+
+ barfoo
+
+
+
+
+ 1 1
+
+
+
+
+