(Closes #2146) enhance createLiterals to merge context, attributes and pass attribute name through to context functions

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9676 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Paul Spencer
2009-09-17 17:17:11 +00:00
parent 507fd0b86d
commit 6088de516c
2 changed files with 23 additions and 7 deletions

View File

@@ -237,7 +237,7 @@
}
function test_Style_context(t) {
t.plan(2);
t.plan(4);
var rule = new OpenLayers.Rule({
symbolizer: {"Point": {externalGraphic: "${img1}"}},
filter: new OpenLayers.Filter.Comparison({
@@ -265,6 +265,18 @@
}
}});
t.eq(style.createSymbolizer(feature).externalGraphic, "foo10.png", "correctly evaluated symbolizer without rule");
style = new OpenLayers.Style(
{externalGraphic: "${getExternalGraphic}",
pointRadius: "${size}"},
{context: {
getExternalGraphic: function(feature) {
return "foo" + feature.attributes.size + ".png";
}
}});
t.eq(style.createSymbolizer(feature).externalGraphic, "foo10.png", "correctly evaluated symbolizer from context");
t.eq(style.createSymbolizer(feature).pointRadius, 10, "correctly evaluated symbolizer from attributes");
};
function test_Style_findPropertyStyles(t) {