Make test compatible with an old node version

This commit is contained in:
IagoLast 2017-08-18 13:21:22 +02:00
parent 1016f6870c
commit 41133a65ad

View File

@ -18,49 +18,53 @@
*/ */
var assert = require('assert'); var assert = require('assert');
var Carto = require('../lib/carto/index.js'); var Carto = require('../lib/carto/index.js');
var renderer = new Carto.RendererJS({strict: true}); var renderer = new Carto.RendererJS({ strict: true });
describe('Field:filtered propery', function () { describe('Field:filtered propery', function () {
it('should be false when the property is not filtered', function () { it('should be false when the property is not filtered', function () {
var style = ` var style = [
#layer { '#layer {',
marker-fill: red; ' marker-fill: red;',
}`; '}'
].join('\n');
var layers = renderer.render(style).layers[0].shader; var layers = renderer.render(style).layers[0].shader;
assert(!layers['marker-fill'].filtered); assert(!layers['marker-fill'].filtered);
}); });
it('should be true when the property is filtered', function () { it('should be true when the property is filtered', function () {
style = ` var style = [
#layer { '#layer {',
[foo > 30]{ ' [foo > 30] {',
marker-fill: red; ' marker-fill: red;',
} ' }',
}`; '}'
].join('\n');
var layers = renderer.render(style).layers[0].shader; var layers = renderer.render(style).layers[0].shader;
assert(layers['marker-fill'].filtered); assert(layers['marker-fill'].filtered);
}); });
it('should be true when the property is filtered at first level', function () { it('should be true when the property is filtered at first level', function () {
style = ` var style = [
#layer [foo > 30]{ '#layer [foo > 30] {',
marker-fill: red; ' marker-fill: red;',
}`; '}`'
].join('\n');
var layers = renderer.render(style).layers[0].shader; var layers = renderer.render(style).layers[0].shader;
assert(layers['marker-fill'].filtered); assert(layers['marker-fill'].filtered);
}); });
it('should be false when the property is not filterd but there is another filtered properties', function () { it('should be false when the property is not filterd but there is another filtered properties', function () {
style = ` var style = [
#layer { '#layer {',
marker-fill: red; ' marker-fill: red;',
[bar < 200]{ ' [bar < 200]{',
marker-allow-overlap: false; ' marker-allow-overlap: false;',
} ' }',
}`; '}`'
].join('\n');
var layers = renderer.render(style).layers[0].shader; var layers = renderer.render(style).layers[0].shader;
@ -69,14 +73,14 @@ describe('Field:filtered propery', function () {
}); });
it('should be true when the property is filtered and have a default value', function () { it('should be true when the property is filtered and have a default value', function () {
style = ` var style = [
#layer { '#layer {',
marker-fill: red; ' marker-fill: red;',
[bar < 200]{ ' [bar < 200]{',
marker-fill: blue; ' marker-fill: blue;',
} ' }',
}`; '}`'
].join('\n');
var layers = renderer.render(style).layers[0].shader; var layers = renderer.render(style).layers[0].shader;
assert(layers['marker-fill'].filtered); assert(layers['marker-fill'].filtered);