Merge pull request #6801 from ahocevar/renderfeature-getid
Add getId method for ol.render.Feature
This commit is contained in:
@@ -73,12 +73,19 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
|
||||
});
|
||||
|
||||
it('parses id property', function() {
|
||||
// ol.Feature
|
||||
var format = new ol.format.MVT({
|
||||
featureClass: ol.Feature,
|
||||
layers: ['building']
|
||||
});
|
||||
var features = format.readFeatures(data);
|
||||
expect(features[0].getId()).to.be(2);
|
||||
// ol.render.Feature
|
||||
format = new ol.format.MVT({
|
||||
layers: ['building']
|
||||
});
|
||||
features = format.readFeatures(data);
|
||||
expect(features[0].getId()).to.be(2);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ describe('ol.render.Feature', function() {
|
||||
describe('Constructor', function() {
|
||||
it('creates an instance', function() {
|
||||
renderFeature =
|
||||
new ol.render.Feature(type, flatCoordinates, ends, properties);
|
||||
new ol.render.Feature(type, flatCoordinates, ends, properties, 'foo');
|
||||
expect(renderFeature).to.be.a(ol.render.Feature);
|
||||
});
|
||||
});
|
||||
@@ -57,6 +57,12 @@ describe('ol.render.Feature', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getId()', function() {
|
||||
it('returns the feature id', function() {
|
||||
expect(renderFeature.getId()).to.be('foo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getProperties()', function() {
|
||||
it('returns the properties it was created with', function() {
|
||||
expect(renderFeature.getProperties()).to.equal(properties);
|
||||
|
||||
Reference in New Issue
Block a user