From b644e9588bb9fb517ec1f3360322fba196b7350e Mon Sep 17 00:00:00 2001
From: Young Hahn
Date: Mon, 30 Apr 2012 02:48:22 -0400
Subject: [PATCH] Add test for parameter rendering.
---
lib/carto/renderer.js | 11 +++++++----
test/rendering/parameters.mml | 28 ++++++++++++++++++++++++++++
test/rendering/parameters.result | 20 ++++++++++++++++++++
3 files changed, 55 insertions(+), 4 deletions(-)
create mode 100644 test/rendering/parameters.mml
create mode 100644 test/rendering/parameters.result
diff --git a/lib/carto/renderer.js b/lib/carto/renderer.js
index b60b95e..60b466f 100644
--- a/lib/carto/renderer.js
+++ b/lib/carto/renderer.js
@@ -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(' ' + v + '');
+ break;
+ // Properties that require CDATA.
case 'name':
case 'description':
case 'legend':
case 'attribution':
case 'template':
- case 'minzoom':
- case 'maxzoom':
- case 'version':
- memo.push(' ' + v + '');
+ memo.push(' ');
break;
// Mapnik image format.
case 'format':
diff --git a/test/rendering/parameters.mml b/test/rendering/parameters.mml
new file mode 100644
index 0000000..15ade3c
--- /dev/null
+++ b/test/rendering/parameters.mml
@@ -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": "This is HTML.
",
+ "attribution": "OpenStreetMap",
+ "template": "{{NAME}}",
+ "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"
+ }
+ }]
+}
diff --git a/test/rendering/parameters.result b/test/rendering/parameters.result
new file mode 100644
index 0000000..efa6df6
--- /dev/null
+++ b/test/rendering/parameters.result
@@ -0,0 +1,20 @@
+
+
+
]]>
+ OpenStreetMap]]>
+ {{NAME}}]]>
+ 0
+ 12
+ 1.0.0
+ png
+ world
+ NAME
+
+
+