-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Number validation should fail on NaN (#8615)
* Number validation should fail on NaN * Avoid Number.isNaN * Add runtime checks * Add render and unit test * Remove not useful unit test * Revert debug page change
- Loading branch information
Showing
7 changed files
with
185 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"width": 64, | ||
"height": 64 | ||
} | ||
}, | ||
"sources": { | ||
"geojson": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "Point", | ||
"coordinates": [ | ||
0, | ||
0 | ||
] | ||
} | ||
} | ||
}, | ||
"glyphs": "local://glyphs/{fontstack}/{range}.pbf", | ||
"layers": [ | ||
{ | ||
"id": "symbol", | ||
"type": "symbol", | ||
"source": "geojson", | ||
"layout": { | ||
"text-size": ["sqrt", -1], | ||
"text-field": "ABC", | ||
"text-font": [ | ||
"Open Sans Semibold", | ||
"Arial Unicode MS Bold" | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{ | ||
"version": 8, | ||
"sources": { | ||
"point": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "FeatureCollection", | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [ 0, 0 ] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"layers": [ | ||
{ | ||
"id": "valid", | ||
"type": "circle", | ||
"source": "point", | ||
"paint": { | ||
"circle-radius": 5 | ||
} | ||
}, | ||
{ | ||
"id": "zero", | ||
"type": "circle", | ||
"source": "point", | ||
"paint": { | ||
"circle-radius": 0 | ||
} | ||
}, | ||
{ | ||
"id": "less-than-zero", | ||
"type": "circle", | ||
"source": "point", | ||
"paint": { | ||
"circle-radius": -1 | ||
} | ||
}, | ||
{ | ||
"id": "null-not-number", | ||
"type": "circle", | ||
"source": "point", | ||
"paint": { | ||
"circle-radius": null | ||
} | ||
}, | ||
{ | ||
"id": "object-not-number", | ||
"type": "circle", | ||
"source": "point", | ||
"paint": { | ||
"circle-radius": {} | ||
} | ||
}, | ||
{ | ||
"id": "array-not-number", | ||
"type": "circle", | ||
"source": "point", | ||
"paint": { | ||
"circle-radius": [] | ||
} | ||
}, | ||
{ | ||
"id": "boolean-not-number", | ||
"type": "circle", | ||
"source": "point", | ||
"paint": { | ||
"circle-radius": true | ||
} | ||
}, | ||
{ | ||
"id": "expression", | ||
"type": "circle", | ||
"source": "point", | ||
"paint": { | ||
"circle-radius": ["sqrt", 16] | ||
} | ||
}, | ||
{ | ||
"id": "expression-invalid", | ||
"type": "circle", | ||
"source": "point", | ||
"paint": { | ||
"circle-radius": ["/", 0, 0] | ||
} | ||
} | ||
] | ||
} |
25 changes: 25 additions & 0 deletions
25
test/unit/style-spec/fixture/numbers.output-api-supported.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[ | ||
{ | ||
"line": 42, | ||
"message": "layers[2].paint.circle-radius: -1 is less than the minimum value 0" | ||
}, | ||
{ | ||
"message": "layers[3].paint.circle-radius: number expected, null found" | ||
}, | ||
{ | ||
"line": 58, | ||
"message": "layers[4].paint.circle-radius: missing required property \"stops\"" | ||
}, | ||
{ | ||
"line": 66, | ||
"message": "layers[5].paint.circle-radius: number expected, array found" | ||
}, | ||
{ | ||
"line": 74, | ||
"message": "layers[6].paint.circle-radius: number expected, boolean found" | ||
}, | ||
{ | ||
"line": 6, | ||
"message": "source.data: Unsupported property \"data\"" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[ | ||
{ | ||
"message": "layers[2].paint.circle-radius: -1 is less than the minimum value 0", | ||
"line": 42 | ||
}, | ||
{ | ||
"message": "layers[3].paint.circle-radius: number expected, null found" | ||
}, | ||
{ | ||
"message": "layers[4].paint.circle-radius: missing required property \"stops\"", | ||
"line": 58 | ||
}, | ||
{ | ||
"message": "layers[5].paint.circle-radius: number expected, array found", | ||
"line": 66 | ||
}, | ||
{ | ||
"message": "layers[6].paint.circle-radius: number expected, boolean found", | ||
"line": 74 | ||
} | ||
] |