Add test for parameter rendering.
This commit is contained in:
parent
795f2c82d0
commit
b644e9588b
@ -86,15 +86,18 @@ carto.Renderer.prototype.render = function render(m, callback) {
|
||||
// Non URL-bound TileJSON properties.
|
||||
case 'bounds':
|
||||
case 'center':
|
||||
case 'minzoom':
|
||||
case 'maxzoom':
|
||||
case 'version':
|
||||
memo.push(' <Parameter name="' + k + '">' + v + '</Parameter>');
|
||||
break;
|
||||
// Properties that require CDATA.
|
||||
case 'name':
|
||||
case 'description':
|
||||
case 'legend':
|
||||
case 'attribution':
|
||||
case 'template':
|
||||
case 'minzoom':
|
||||
case 'maxzoom':
|
||||
case 'version':
|
||||
memo.push(' <Parameter name="' + k + '">' + v + '</Parameter>');
|
||||
memo.push(' <Parameter name="' + k + '"><![CDATA[' + v + ']]></Parameter>');
|
||||
break;
|
||||
// Mapnik image format.
|
||||
case 'format':
|
||||
|
28
test/rendering/parameters.mml
Normal file
28
test/rendering/parameters.mml
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||
"bounds": [-180,-85,180,85],
|
||||
"center": [-78,40,8],
|
||||
"name": "Parameters",
|
||||
"description": "Mapnik parameter test.",
|
||||
"legend": "<p>This is HTML.</p>",
|
||||
"attribution": "<a href='http://openstreetmap.org'>OpenStreetMap</a>",
|
||||
"template": "<b>{{NAME}}</b>",
|
||||
"minzoom": 0,
|
||||
"maxzoom": 12,
|
||||
"version": "1.0.0",
|
||||
"format": "png",
|
||||
"interactivity": {
|
||||
"layer": "world",
|
||||
"fields": ["NAME"]
|
||||
},
|
||||
"omitted": "Omitted property.",
|
||||
"Stylesheet": [],
|
||||
"Layer": [{
|
||||
"name": "world",
|
||||
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||
"Datasource": {
|
||||
"file": "http://tilemill-data.s3.amazonaws.com/test_data/shape_demo.zip",
|
||||
"type": "shape"
|
||||
}
|
||||
}]
|
||||
}
|
20
test/rendering/parameters.result
Normal file
20
test/rendering/parameters.result
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE Map[]>
|
||||
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
|
||||
<Parameters>
|
||||
<Parameter name="bounds">-180,-85,180,85</Parameter>
|
||||
<Parameter name="center">-78,40,8</Parameter>
|
||||
<Parameter name="name"><![CDATA[Parameters]]></Parameter>
|
||||
<Parameter name="description"><![CDATA[Mapnik parameter test.]]></Parameter>
|
||||
<Parameter name="legend"><![CDATA[<p>This is HTML.</p>]]></Parameter>
|
||||
<Parameter name="attribution"><![CDATA[<a href='http://openstreetmap.org'>OpenStreetMap</a>]]></Parameter>
|
||||
<Parameter name="template"><![CDATA[<b>{{NAME}}</b>]]></Parameter>
|
||||
<Parameter name="minzoom">0</Parameter>
|
||||
<Parameter name="maxzoom">12</Parameter>
|
||||
<Parameter name="version">1.0.0</Parameter>
|
||||
<Parameter name="format">png</Parameter>
|
||||
<Parameter name="interactivity_layer">world</Parameter>
|
||||
<Parameter name="interactivity_fields">NAME</Parameter>
|
||||
</Parameters>
|
||||
</Map>
|
||||
|
Loading…
Reference in New Issue
Block a user