Accept ol.StyleFunction in ol.Feature#setStyle()
This commit is contained in:
@@ -303,7 +303,7 @@ describe('ol.Feature', function() {
|
||||
var style = new ol.style.Style();
|
||||
|
||||
var styleFunction = function(feature, resolution) {
|
||||
return null;
|
||||
return resolution;
|
||||
};
|
||||
|
||||
it('accepts a single style', function() {
|
||||
@@ -321,9 +321,20 @@ describe('ol.Feature', function() {
|
||||
});
|
||||
|
||||
it('accepts a style function', function() {
|
||||
var feature = new ol.Feature();
|
||||
function featureStyleFunction(resolution) {
|
||||
return styleFunction(this, resolution);
|
||||
}
|
||||
feature.setStyle(featureStyleFunction);
|
||||
expect(feature.getStyleFunction()).to.be(featureStyleFunction);
|
||||
expect(feature.getStyleFunction()(42)).to.be(42);
|
||||
});
|
||||
|
||||
it('accepts a layer style function', function() {
|
||||
var feature = new ol.Feature();
|
||||
feature.setStyle(styleFunction);
|
||||
expect(feature.getStyleFunction()).to.be(styleFunction);
|
||||
expect(feature.getStyleFunction()).to.not.be(styleFunction);
|
||||
expect(feature.getStyleFunction()(42)).to.be(42);
|
||||
});
|
||||
|
||||
it('accepts null', function() {
|
||||
|
||||
Reference in New Issue
Block a user