fixed cartocss with single quoted strings
This commit is contained in:
parent
fba91a0633
commit
0d2dddf978
@ -92,7 +92,7 @@ tree.Filterset.prototype.toJS = function(env) {
|
||||
val = filter._val.toString(true);
|
||||
}
|
||||
var attrs = "data";
|
||||
return attrs + "." + filter.key.value + " " + op + " " + (val.is === 'string' ? "'"+ val +"'" : val);
|
||||
return attrs + "." + filter.key.value + " " + op + " " + (val.is === 'string' ? "'" + val.toString().replace(/'/g, "\\'") + "'" : val);
|
||||
}).join(' && ');
|
||||
};
|
||||
|
||||
|
@ -129,7 +129,14 @@ describe('RenderingJS', function() {
|
||||
shader = (new carto.RendererJS({ debug: true })).render(style);
|
||||
layer0 = shader.getLayers()[0];
|
||||
assert(layer0.isVariable());
|
||||
});
|
||||
|
||||
it("should parse styles with string", function() {
|
||||
var style = '#test { [column = "test\'ing"] { marker-width: 10; } }';
|
||||
var shader = (new carto.RendererJS({ debug: true })).render(style);
|
||||
var layer = shader.getLayers()[0];
|
||||
var props = layer.getStyle({column: 'test\'ing'}, { 'zoom': 0, 'frame-offset': 10 });
|
||||
assert(props['marker-width'] === 10);
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user