Named exports from ol/style/Style
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import Layer from '../../../../src/ol/layer/Layer.js';
|
||||
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
||||
import VectorSource from '../../../../src/ol/source/Vector.js';
|
||||
import Style from '../../../../src/ol/style/Style.js';
|
||||
import Style, {createDefaultStyle} from '../../../../src/ol/style/Style.js';
|
||||
|
||||
|
||||
describe('ol.layer.Vector', function() {
|
||||
@@ -74,10 +74,10 @@ describe('ol.layer.Vector', function() {
|
||||
});
|
||||
|
||||
it('updates the internal style function', function() {
|
||||
expect(layer.getStyleFunction()).to.be(Style.defaultFunction);
|
||||
expect(layer.getStyleFunction()).to.be(createDefaultStyle);
|
||||
layer.setStyle(style);
|
||||
expect(layer.getStyleFunction()).not.to.be(
|
||||
Style.defaultFunction);
|
||||
createDefaultStyle);
|
||||
});
|
||||
|
||||
it('allows setting an null style', function() {
|
||||
@@ -89,8 +89,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(Style.defaultFunction);
|
||||
expect(layer.getStyleFunction()).to.be(Style.defaultFunction);
|
||||
expect(layer.getStyle()).to.be(createDefaultStyle);
|
||||
expect(layer.getStyleFunction()).to.be(createDefaultStyle);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -105,7 +105,7 @@ describe('ol.layer.Vector', function() {
|
||||
source: source
|
||||
});
|
||||
|
||||
expect(layer.getStyle()).to.be(Style.defaultFunction);
|
||||
expect(layer.getStyle()).to.be(createDefaultStyle);
|
||||
|
||||
layer.setStyle(style);
|
||||
expect(layer.getStyle()).to.be(style);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
import Style from '../../../../src/ol/style/Style.js';
|
||||
import Style, {toFunction} from '../../../../src/ol/style/Style.js';
|
||||
import Fill from '../../../../src/ol/style/Fill.js';
|
||||
import CircleStyle from '../../../../src/ol/style/Circle.js';
|
||||
import Stroke from '../../../../src/ol/style/Stroke.js';
|
||||
@@ -240,16 +240,16 @@ describe('ol.style.Style', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('ol.style.Style.createFunction()', function() {
|
||||
describe('toFunction()', function() {
|
||||
const style = new Style();
|
||||
|
||||
it('creates a style function from a single style', function() {
|
||||
const styleFunction = Style.createFunction(style);
|
||||
const styleFunction = toFunction(style);
|
||||
expect(styleFunction()).to.eql([style]);
|
||||
});
|
||||
|
||||
it('creates a style function from an array of styles', function() {
|
||||
const styleFunction = Style.createFunction([style]);
|
||||
const styleFunction = toFunction([style]);
|
||||
expect(styleFunction()).to.eql([style]);
|
||||
});
|
||||
|
||||
@@ -257,13 +257,13 @@ describe('ol.style.Style.createFunction()', function() {
|
||||
const original = function() {
|
||||
return [style];
|
||||
};
|
||||
const styleFunction = Style.createFunction(original);
|
||||
const styleFunction = toFunction(original);
|
||||
expect(styleFunction).to.be(original);
|
||||
});
|
||||
|
||||
it('throws on (some) unexpected input', function() {
|
||||
expect(function() {
|
||||
Style.createFunction({bogus: 'input'});
|
||||
toFunction({bogus: 'input'});
|
||||
}).to.throwException();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user