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() {
var pointRadius = 4.5,

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

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