Dispatch change on feature id change

This commit is contained in:
Tim Schaub
2014-05-20 09:35:14 -06:00
parent 305e9b0df1
commit 34cabd1579
2 changed files with 29 additions and 0 deletions

View File

@@ -232,6 +232,34 @@ describe('ol.Feature', function() {
});
describe('#setId()', function() {
it('sets the feature identifier', function() {
var feature = new ol.Feature();
expect(feature.getId()).to.be(undefined);
feature.setId('foo');
expect(feature.getId()).to.be('foo');
});
it('accepts a string or number', function() {
var feature = new ol.Feature();
feature.setId('foo');
expect(feature.getId()).to.be('foo');
feature.setId(2);
expect(feature.getId()).to.be(2);
});
it('dispatches the "change" event', function(done) {
var feature = new ol.Feature();
feature.on('change', function() {
expect(feature.getId()).to.be('foo');
done();
});
feature.setId('foo');
});
});
describe('#getStyleFunction()', function() {
var styleFunction = function(resolution) {