diff --git a/test/spec/ol/format/gpxformat.test.js b/test/spec/ol/format/gpxformat.test.js
index 7d880ed391..1a0f9c7180 100644
--- a/test/spec/ol/format/gpxformat.test.js
+++ b/test/spec/ol/format/gpxformat.test.js
@@ -394,6 +394,73 @@ describe('ol.format.GPX', function() {
});
+ describe('extensions support', function() {
+
+ beforeEach(function() {
+ format = new ol.format.GPX({
+ readExtensions: function(feature, extensionsNode) {
+ var nodes = extensionsNode.getElementsByTagName('id');
+ var id = nodes.item(0).textContent;
+ feature.setId(id);
+ }
+ });
+ });
+
+ it('can process extensions from wpt', function() {
+ var text =
+ '' +
+ ' ' +
+ ' ' +
+ ' feature-id' +
+ ' ' +
+ ' ' +
+ '';
+ var fs = format.readFeatures(text);
+ expect(fs).to.have.length(1);
+ var feature = fs[0];
+ expect(feature.getId()).to.be('feature-id');
+ });
+
+ it('can process extensions from rte', function() {
+ var text =
+ '' +
+ ' ' +
+ ' ' +
+ ' bar' +
+ ' feature-id' +
+ ' ' +
+ ' ' +
+ '';
+ var fs = format.readFeatures(text);
+ expect(fs).to.have.length(1);
+ var feature = fs[0];
+ expect(feature.getId()).to.be('feature-id');
+ });
+
+ it('can process extensions from trk, not trkpt', function() {
+ var text =
+ '' +
+ ' ' +
+ ' ' +
+ ' feature-id' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' another-feature-id' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ '';
+ var fs = format.readFeatures(text);
+ expect(fs).to.have.length(1);
+ var feature = fs[0];
+ expect(feature.getId()).to.be('feature-id');
+ });
+
+ });
+
});
});