Add tests for setGeometry
This commit is contained in:
@@ -11,6 +11,35 @@ describe('ol.style.Style', function() {
|
|||||||
expect(style.getZIndex()).to.be(0.7);
|
expect(style.getZIndex()).to.be(0.7);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('#setGeometry', function() {
|
||||||
|
var style = new ol.style.Style();
|
||||||
|
|
||||||
|
it('creates a geometry function from a string', function() {
|
||||||
|
var feature = new ol.Feature();
|
||||||
|
feature.set('myGeom', new ol.geom.Point([0, 0]));
|
||||||
|
style.setGeometry('myGeom');
|
||||||
|
expect(style.getGeometryFunction()(feature))
|
||||||
|
.to.eql(feature.get('myGeom'));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('creates a geometry function from a geometry', function() {
|
||||||
|
var geom = new ol.geom.Point([0, 0]);
|
||||||
|
style.setGeometry(geom);
|
||||||
|
expect(style.getGeometryFunction()())
|
||||||
|
.to.eql(geom);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns the configured geometry function', function() {
|
||||||
|
var geom = new ol.geom.Point([0, 0]);
|
||||||
|
style.setGeometry(function() {
|
||||||
|
return geom;
|
||||||
|
});
|
||||||
|
expect(style.getGeometryFunction()())
|
||||||
|
.to.eql(geom);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('ol.style.createStyleFunction()', function() {
|
describe('ol.style.createStyleFunction()', function() {
|
||||||
@@ -42,4 +71,6 @@ describe('ol.style.createStyleFunction()', function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
goog.require('ol.Feature');
|
||||||
|
goog.require('ol.geom.Point');
|
||||||
goog.require('ol.style.Style');
|
goog.require('ol.style.Style');
|
||||||
|
|||||||
Reference in New Issue
Block a user