Merge pull request #18 from CartoDB/turbo-carto-fn-support

Adds support for other turbo-carto functions
This commit is contained in:
Raul Ochoa 2016-07-20 14:32:34 +02:00 committed by GitHub
commit f17aea8657
2 changed files with 26 additions and 0 deletions

View File

@ -167,6 +167,15 @@ var _mapnik_reference_latest = {
["colorize-alpha", -1], ["colorize-alpha", -1],
["color-to-alpha", 1], ["color-to-alpha", 1],
["scale-hsla", 8], ["scale-hsla", 8],
["buckets", -1],
["category", -1],
["equal", -1],
["headtails", -1],
["jenks", -1],
["quantiles", -1],
["cartocolor", -1],
["colorbrewer", -1],
["range", -1],
["ramp", -1] ["ramp", -1]
], ],
"doc": "A list of image filters." "doc": "A list of image filters."

View File

@ -166,4 +166,21 @@ describe('RenderingJS', function() {
assert.equal(st.args[2].value, 'jenks'); assert.equal(st.args[2].value, 'jenks');
}) })
it("should parse turbocarto with inner functions", function(){
var css = [
'#layer {',
' marker-width: ramp([cartodb_id], cartocolor(Bold), category(10));',
'}'
].join('\n');
var shader = (new carto.RendererJS({ debug: true })).render(css);
var layer = shader.getLayers()[0];
var st = layer.shader['marker-width'].style({}, {zoom: 1});
assert.equal(st.name, "ramp");
assert.equal(st.args.length, 3);
assert.equal(st.args[1].name, 'cartocolor');
assert.equal(st.args[1].args[0].value, 'Bold');
assert.equal(st.args[2].name, 'category');
assert.equal(st.args[2].args[0].value, 10);
});
}); });