Default value for zIndex

This commit is contained in:
Tim Schaub
2013-10-02 16:37:19 -06:00
parent 43c581ef5f
commit bfa257eac1
20 changed files with 262 additions and 124 deletions
+30 -1
View File
@@ -77,7 +77,7 @@ describe('ol.style.Icon', function() {
expect(literal.xOffset).to.be(20);
expect(literal.yOffset).to.be(30);
expect(literal.url).to.be('http://example.com/1.png');
expect(literal.zIndex).to.be(undefined);
expect(literal.zIndex).to.be(0);
});
it('can be called without a feature', function() {
@@ -250,6 +250,35 @@ describe('ol.style.Icon', function() {
expect(literal.zIndex).to.be(4);
});
it('applies default zIndex if none', function() {
var symbolizer = new ol.style.Icon({
height: 10,
width: 20,
url: 'http://example.com/1.png'
});
var literal = symbolizer.createLiteral(ol.geom.GeometryType.POINT);
expect(literal).to.be.a(ol.style.IconLiteral);
expect(literal.zIndex).to.be(0);
});
it('casts zIndex to number', function() {
var symbolizer = new ol.style.Icon({
zIndex: ol.expr.parse('zIndex'),
width: 10,
url: 'http://example.com/1.png'
});
var feature = new ol.Feature({
zIndex: '42',
geometry: new ol.geom.Point([1, 2])
});
var literal = symbolizer.createLiteral(feature);
expect(literal).to.be.a(ol.style.IconLiteral);
expect(literal.zIndex).to.be(42);
});
});
describe('#getHeight()', function() {