This commit is contained in:
Mike Bostock 2012-12-12 21:22:54 -08:00
Родитель 4a9a9cad0b
Коммит 1c529da03e
2 изменённых файлов: 22 добавлений и 15 удалений

Просмотреть файл

@ -1,4 +1,7 @@
// TODO fallback for projections that don't implement point, polygon? (or fix albersUsa?) // TODO fallback for projections that don't implement stream? (or fix albersUsa?)
// TODO cache pathBuffer / pathContext across invocations?
// TODO better encapsulation for d3_geo_pathArea; move to area.js
// TODO better encapsulation for d3_geo_pathCentroid; move to centroid.js
d3.geo.path = function() { d3.geo.path = function() {
var pointRadius = 4.5, var pointRadius = 4.5,

Просмотреть файл

@ -89,20 +89,24 @@ suite.addBatch({
]); ]);
}, },
"returns null when passed null or undefined": function(path) { "with no context": {
assert.isNull(path(null)); topic: function(path) {
assert.isNull(path(undefined)); return d3.geo.path().projection(path.projection());
assert.isNull(path());
}, },
"returns null when passed null or undefined": function(path) {
"bogus type name": function(path) { assert.equal(path(null), null);
assert.isNull(path({ assert.equal(path(undefined), null);
assert.equal(path(), null);
},
"returns null with bogus type name": function(path) {
assert.equal(path({
type: "Feature", type: "Feature",
geometry: { geometry: {
type: "__proto__", type: "__proto__",
coordinates: [[[-63.03, 18.02], [-63.14, 18.06], [-63.01, 18.07], [-63.03, 18.02]]] coordinates: [[[-63.03, 18.02], [-63.14, 18.06], [-63.01, 18.07], [-63.03, 18.02]]]
}, },
})); }), null);
}
}, },
"projection": { "projection": {