2011-09-10 18:37:39 +04:00
|
|
|
require("../env");
|
|
|
|
|
|
|
|
var vows = require("vows"),
|
|
|
|
assert = require("assert");
|
|
|
|
|
|
|
|
var suite = vows.describe("d3.geo.path");
|
|
|
|
|
|
|
|
suite.addBatch({
|
|
|
|
"path": {
|
|
|
|
topic: d3.geo.path,
|
2012-09-27 08:01:42 +04:00
|
|
|
"returns null when passed a null object": function(path) {
|
|
|
|
assert.isNull(path(null));
|
|
|
|
},
|
2012-09-23 03:08:27 +04:00
|
|
|
"projection": {
|
|
|
|
"returns the current projection when called with no arguments": function() {
|
|
|
|
var path = d3.geo.path(), projection = d3.geo.albers();
|
|
|
|
path.projection(projection);
|
|
|
|
assert.strictEqual(path.projection(), projection);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"pointRadius": {
|
|
|
|
"returns the current point radius when called with no arguments": function() {
|
|
|
|
var path = d3.geo.path(), radius = function() { return 5; };
|
|
|
|
assert.strictEqual(path.pointRadius(), 4.5);
|
|
|
|
assert.strictEqual(path.pointRadius(radius).pointRadius(), radius);
|
|
|
|
}
|
|
|
|
},
|
2011-09-10 18:37:39 +04:00
|
|
|
"Polygon": function(path) {
|
|
|
|
assert.equal(path({
|
|
|
|
type: "Feature",
|
|
|
|
geometry: {
|
|
|
|
type: "Polygon",
|
|
|
|
coordinates: [[[-63.03, 18.02], [-63.14, 18.06], [-63.01, 18.07], [-63.03, 18.02]]]
|
|
|
|
},
|
|
|
|
}), "M984.5652086349427,468.99159422596244L981.8396467935554,467.9114977057422L985.0785139575695,467.688661596079Z");
|
2012-02-21 20:42:37 +04:00
|
|
|
},
|
|
|
|
"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]]]
|
|
|
|
},
|
|
|
|
}));
|
2011-09-10 18:37:39 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
suite.export(module);
|