Optional polygon stroke or fill

This commit is contained in:
Tim Schaub
2013-03-07 22:28:39 -07:00
parent f93bf2ad77
commit 77355ca634
2 changed files with 84 additions and 30 deletions

View File

@@ -46,7 +46,7 @@ describe('ol.style.Polygon', function() {
it('accepts expressions', function() {
var symbolizer = new ol.style.Polygon({
opacity: new ol.Expression('value / 100'),
fillStyle: ol.Expression('fillAttr')
fillStyle: new ol.Expression('fillAttr')
});
expect(symbolizer).toBeA(ol.style.Polygon);
});
@@ -70,6 +70,19 @@ describe('ol.style.Polygon', function() {
expect(literal).toBeA(ol.style.PolygonLiteral);
expect(literal.opacity).toBe(42 / 100);
expect(literal.fillStyle).toBe('#ff0000');
expect(literal.strokeStyle).toBeUndefined();
});
it('applies default strokeWidth if only strokeStyle is given', function() {
var symbolizer = new ol.style.Polygon({
strokeStyle: '#ff0000'
});
var literal = symbolizer.createLiteral();
expect(literal).toBeA(ol.style.PolygonLiteral);
expect(literal.strokeStyle).toBe('#ff0000');
expect(literal.strokeWidth).toBe(1.5);
expect(literal.fillStyle).toBeUndefined();
});
});