add an optional argument to getAttributes so we can get a feature's attributes except for the geometry ones

This commit is contained in:
Bart van den Eijnden
2013-11-19 15:39:22 +01:00
parent 936f86568e
commit 8d03fa1197
4 changed files with 28 additions and 10 deletions

View File

@@ -78,6 +78,23 @@ describe('ol.Feature', function() {
expect(attributes.ten).to.be(10);
});
it('returns an object with all attributes except geometry', function() {
var point = new ol.geom.Point([15, 30]);
var feature = new ol.Feature({
foo: 'bar',
ten: 10,
loc: point
});
var attributes = feature.getAttributes(true);
var keys = goog.object.getKeys(attributes);
expect(keys.sort()).to.eql(['foo', 'ten']);
expect(attributes.foo).to.be('bar');
expect(attributes.ten).to.be(10);
});
});