Add new tests for FeatureOverlay
In the process of creating these tests, a bug with setting this._style was also fixed.
This commit is contained in:
@@ -65,7 +65,7 @@ ol.FeatureOverlay = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.style.Style|Array.<ol.style.Style>|ol.feature.StyleFunction}
|
* @type {ol.style.Style|Array.<ol.style.Style>|ol.feature.StyleFunction}
|
||||||
*/
|
*/
|
||||||
this.style_ = null;
|
this.style_ = goog.isDef(options.style) ? options.style : null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
goog.provide('ol.test.FeatureOverlay');
|
||||||
|
|
||||||
|
describe('ol.FeatureOverlay', function() {
|
||||||
|
|
||||||
|
describe('constructor', function() {
|
||||||
|
|
||||||
|
it('creates an new feature overlay', function() {
|
||||||
|
var featureOverlay = new ol.FeatureOverlay();
|
||||||
|
expect(featureOverlay).to.be.a(ol.FeatureOverlay);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('takes features', function() {
|
||||||
|
var featureOverlay = new ol.FeatureOverlay({
|
||||||
|
features: [new ol.Feature(new ol.geom.Point([0, 0]))]
|
||||||
|
});
|
||||||
|
expect(featureOverlay.getFeatures().getLength()).to.be(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('takes a style', function() {
|
||||||
|
var style = [new ol.style.Style()];
|
||||||
|
var featureOverlay = new ol.FeatureOverlay({
|
||||||
|
style: [new ol.style.Style()]
|
||||||
|
});
|
||||||
|
expect(featureOverlay.getStyle()).to.eql(style);
|
||||||
|
expect(featureOverlay.getStyleFunction()()).to.eql(style);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
goog.require('ol.Feature');
|
||||||
|
goog.require('ol.FeatureOverlay');
|
||||||
|
goog.require('ol.geom.Point');
|
||||||
|
goog.require('ol.style.Style');
|
||||||
Reference in New Issue
Block a user