Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
fix #471 regression, correct fix for #411 and amend test case to test…
Browse files Browse the repository at this point in the history
… for strings that begin with a number, but shouldn't be treated as one
  • Loading branch information
nebulon42 committed May 1, 2017
1 parent 862d639 commit 81c4e1d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/carto/tree/filterset.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var tree = require('../tree'),
_ = require('lodash');
var tree = require('../tree');

tree.Filterset = function Filterset() {
this.filters = {};
Expand Down Expand Up @@ -102,7 +101,7 @@ tree.Filterset.prototype.addable = function(filter) {
value = filter.val.toString(),
valueIsNull = filter.val.is == 'keyword' && value == 'null';

if (!_.isNaN(parseFloat(value))) {
if (value.match(/^[+-]?[0-9]+(\.[0-9]*)?([e|E][+-]?[0-9]+)?$/)) {
value = parseFloat(value);
}

Expand Down
6 changes: 6 additions & 0 deletions test/rendering/issue_411.mss
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@
text-fill: #ff0000;
text-face-name: 'Arial';
}
[zoom >= 3][render = '1_outline'] {
text-name: "[name]";
text-size: 12;
text-fill: #ff0000;
text-face-name: 'Arial';
}
}
5 changes: 5 additions & 0 deletions test/rendering/issue_411.result
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
<Filter>([way_pixels] > 1e-7) and ([way_pixels] < 0.000036)</Filter>
<TextSymbolizer face-name="Arial" size="10" text="[name]" fill="#ff0000"/>
</Rule>
<Rule>
<MaxScaleDenominator>100000000</MaxScaleDenominator>
<Filter>([render] = '1_outline')</Filter>
<TextSymbolizer face-name="Arial" size="12" text="[name]" fill="#ff0000"/>
</Rule>
</Style>
<Layer
name="test"
Expand Down

0 comments on commit 81c4e1d

Please sign in to comment.