Static ol.style.Style functions
This commit is contained in:
@@ -76,10 +76,10 @@ describe('ol.layer.Vector', function() {
|
||||
});
|
||||
|
||||
it('updates the internal style function', function() {
|
||||
expect(layer.getStyleFunction()).to.be(ol.style.defaultStyleFunction);
|
||||
expect(layer.getStyleFunction()).to.be(ol.style.Style.defaultFunction);
|
||||
layer.setStyle(style);
|
||||
expect(layer.getStyleFunction()).not.to.be(
|
||||
ol.style.defaultStyleFunction);
|
||||
ol.style.Style.defaultFunction);
|
||||
});
|
||||
|
||||
it('allows setting an null style', function() {
|
||||
@@ -91,8 +91,8 @@ describe('ol.layer.Vector', function() {
|
||||
it('sets the default style when passing undefined', function() {
|
||||
layer.setStyle(style);
|
||||
layer.setStyle(undefined);
|
||||
expect(layer.getStyle()).to.be(ol.style.defaultStyleFunction);
|
||||
expect(layer.getStyleFunction()).to.be(ol.style.defaultStyleFunction);
|
||||
expect(layer.getStyle()).to.be(ol.style.Style.defaultFunction);
|
||||
expect(layer.getStyleFunction()).to.be(ol.style.Style.defaultFunction);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -107,7 +107,7 @@ describe('ol.layer.Vector', function() {
|
||||
source: source
|
||||
});
|
||||
|
||||
expect(layer.getStyle()).to.be(ol.style.defaultStyleFunction);
|
||||
expect(layer.getStyle()).to.be(ol.style.Style.defaultFunction);
|
||||
|
||||
layer.setStyle(style);
|
||||
expect(layer.getStyle()).to.be(style);
|
||||
|
||||
@@ -67,16 +67,16 @@ describe('ol.style.Style', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('ol.style.createStyleFunction()', function() {
|
||||
describe('ol.style.Style.createFunction()', function() {
|
||||
var style = new ol.style.Style();
|
||||
|
||||
it('creates a style function from a single style', function() {
|
||||
var styleFunction = ol.style.createStyleFunction(style);
|
||||
var styleFunction = ol.style.Style.createFunction(style);
|
||||
expect(styleFunction()).to.eql([style]);
|
||||
});
|
||||
|
||||
it('creates a style function from an array of styles', function() {
|
||||
var styleFunction = ol.style.createStyleFunction([style]);
|
||||
var styleFunction = ol.style.Style.createFunction([style]);
|
||||
expect(styleFunction()).to.eql([style]);
|
||||
});
|
||||
|
||||
@@ -84,13 +84,13 @@ describe('ol.style.createStyleFunction()', function() {
|
||||
var original = function() {
|
||||
return [style];
|
||||
};
|
||||
var styleFunction = ol.style.createStyleFunction(original);
|
||||
var styleFunction = ol.style.Style.createFunction(original);
|
||||
expect(styleFunction).to.be(original);
|
||||
});
|
||||
|
||||
it('throws on (some) unexpected input', function() {
|
||||
expect(function() {
|
||||
ol.style.createStyleFunction({bogus: 'input'});
|
||||
ol.style.Style.createFunction({bogus: 'input'});
|
||||
}).to.throwException();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user