Default value for zIndex
This commit is contained in:
@@ -49,7 +49,7 @@ describe('ol.style.Fill', function() {
|
||||
expect(literal).to.be.a(ol.style.PolygonLiteral);
|
||||
expect(literal.fillOpacity).to.be(42 / 100);
|
||||
expect(literal.fillColor).to.be('#ff0000');
|
||||
expect(literal.zIndex).to.be(undefined);
|
||||
expect(literal.zIndex).to.be(0);
|
||||
});
|
||||
|
||||
it('applies default opacity', function() {
|
||||
@@ -104,6 +104,33 @@ describe('ol.style.Fill', function() {
|
||||
expect(literal.zIndex).to.be(2);
|
||||
});
|
||||
|
||||
it('applies default zIndex', function() {
|
||||
var symbolizer = new ol.style.Fill({
|
||||
opacity: 0.8
|
||||
});
|
||||
|
||||
var literal = symbolizer.createLiteral(ol.geom.GeometryType.POLYGON);
|
||||
expect(literal).to.be.a(ol.style.PolygonLiteral);
|
||||
expect(literal.zIndex).to.be(0);
|
||||
});
|
||||
|
||||
it('casts zIndex to number', function() {
|
||||
var symbolizer = new ol.style.Fill({
|
||||
zIndex: ol.expr.parse('zIndex'),
|
||||
color: '#ff00ff'
|
||||
});
|
||||
|
||||
var feature = new ol.Feature({
|
||||
zIndex: '11',
|
||||
geometry: new ol.geom.Polygon(
|
||||
[[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]])
|
||||
});
|
||||
|
||||
var literal = symbolizer.createLiteral(feature);
|
||||
expect(literal).to.be.a(ol.style.PolygonLiteral);
|
||||
expect(literal.zIndex).to.be(11);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#getColor()', function() {
|
||||
@@ -135,6 +162,21 @@ describe('ol.style.Fill', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('#getZIndex()', function() {
|
||||
|
||||
it('returns the zIndex', function() {
|
||||
var symbolizer = new ol.style.Fill({
|
||||
color: '#ffffff',
|
||||
zIndex: 11
|
||||
});
|
||||
|
||||
var zIndex = symbolizer.getZIndex();
|
||||
expect(zIndex).to.be.a(ol.expr.Literal);
|
||||
expect(zIndex.getValue()).to.be(11);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#setColor()', function() {
|
||||
|
||||
it('sets the fill color', function() {
|
||||
|
||||
Reference in New Issue
Block a user