Skip to content

Commit 398b283

Browse files
committed
Add test for voronoi links with custom accessors
1 parent c36134c commit 398b283

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

test/geom/voronoi-test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,23 @@ suite.addBatch({
113113
[[480, -1e6], [480, 1e6], [1e6, -1e6], [1e6, 1e6]]
114114
], 1e-6);
115115
}
116+
},
117+
"links": {
118+
topic: function(v) {
119+
return v.y(function(d) { return d.y; });
120+
},
121+
"for two points": function(v) {
122+
assert.deepEqual(v.links([{x: 200, y: 200}, {x: 760, y: 300}]), [
123+
{source: {x: 200, y: 200}, target: {x: 760, y: 300}}
124+
]);
125+
},
126+
"for three points": function(v) {
127+
assert.deepEqual(v.links([{x: 200, y: 200}, {x: 500, y: 250}, {x: 760, y: 300}]), [
128+
{source: {x: 200, y: 200}, target: {x: 760, y: 300}},
129+
{source: {x: 500, y: 250}, target: {x: 760, y: 300}},
130+
{source: {x: 200, y: 200}, target: {x: 500, y: 250}}
131+
]);
132+
}
116133
}
117134
},
118135

0 commit comments

Comments
 (0)